Here can be divided into three situations: first, small mistakes; The second is all wet; The third is the defect.
First, small mistakes
You can write directly to the editor to explain the situation. Be sincere and explain the whole story in detail. The editor will tell you the plan of the matter.
Second, a big mistake.
It may be necessary to make a statement or write another article to correct the mistake. The content of the paper used to revise the last article, including theory, data and scheme, should be convincing and comprehensive. Because this is a "corrected" paper, if there are still mistakes in this article, then this article is not so convincing.
Third, defects.
If it is a defect, it will not have much impact, because the follow-up research is originally to solve the original defect.