From: Yazen Ghannam <yazen.ghannam@amd.com>
To: "Chatradhi, Naveen Krishna" <nchatrad@amd.com>
Cc: linux-edac@vger.kernel.org, bp@alien8.de, mingo@redhat.com,
mchehab@kernel.org, Muralidhara M K <muralimk@amd.com>
Subject: Re: [PATCH 01/14] EDAC/amd64: Move struct fam_type variables into struct amd64_pvt
Date: Mon, 4 Apr 2022 18:00:18 +0000 [thread overview]
Message-ID: <YksyMj8mrHJUs+F7@yaz-ubuntu> (raw)
In-Reply-To: <37449efc-1157-1d48-ec2e-726bf6c7edcb@amd.com>
On Thu, Mar 31, 2022 at 05:45:39PM +0530, Chatradhi, Naveen Krishna wrote:
...
> > > case 0x15:
> > > if (pvt->model == 0x30) {
> > I just noticed that families 15h and 16h aren't matching against a model
> > range. I think we should look into that.
>
> The diff seems fine to me. Yazen, do you have any inputs on this ?
>
Right, I think this patch is moving the code around correctly. But the code
seems incorrect. So I think it should be fixed if it is indeed incorrect.
> >
> > ...
> >
> > > @@ -4142,10 +4012,13 @@ static int probe_one_instance(unsigned int nid)
> > > pvt->mc_node_id = nid;
> > > pvt->F3 = F3;
> > > + pvt->ops = kzalloc(sizeof(*pvt->ops), GFP_KERNEL);
> > > + if (!pvt->ops)
> > > + goto err_out;
> > > +
> > This should goto err_enable so that pvt and above can be freed.
> > > ret = -ENODEV;
> > > - fam_type = per_family_init(pvt);
> > > - if (!fam_type)
> > > - goto err_enable;
> > > + if (per_family_init(pvt))
> > > + goto err_out;
> > >
> > Same here, but pvt->ops should also be freed at this point too.
>
> The hw_info_get() is not called till this point, calling goto err_enable
> would unnecessarily call hw_info_put()
>
> in the exit path. Better to introduce goto err_pvt and goto err_pvt_ops
> like below Or can i split the function
>
> by moving the structure allocation part into a separate helper routine ?
>
> @@ -4101,15 +4101,15 @@ static int probe_one_instance(unsigned int nid)
>
> pvt->ops = kzalloc(sizeof(*pvt->ops), GFP_KERNEL);
> if (!pvt->ops)
> - goto err_enable;
> + goto err_pvt;
>
> ret = -ENODEV;
> if (per_family_init(pvt))
> - goto err_enable;
> + goto err_pvt_ops;
>
> ret = hw_info_get(pvt);
> if (ret < 0)
> - goto err_enable;
> + goto err_pvt_ops;
>
> ret = 0;
> if (!instance_has_memory(pvt)) {
> @@ -4151,6 +4151,11 @@ static int probe_one_instance(unsigned int nid)
>
> err_enable:
> hw_info_put(pvt);
> +
> +err_pvt_ops:
> + kfree(pvt->ops);
> +
> +err_pvt:
> kfree(pvt);
>
This seems okay to me.
Thanks,
Yazen
next prev parent reply other threads:[~2022-04-04 21:39 UTC|newest]
Thread overview: 35+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-02-28 16:13 [PATCH 00/14] EDAC/amd64: move platform specific routines to pvt->ops Naveen Krishna Chatradhi
2022-02-28 16:13 ` [PATCH 01/14] EDAC/amd64: Move struct fam_type variables into struct amd64_pvt Naveen Krishna Chatradhi
2022-03-23 17:19 ` Yazen Ghannam
2022-03-23 21:25 ` Borislav Petkov
[not found] ` <37449efc-1157-1d48-ec2e-726bf6c7edcb@amd.com>
2022-04-04 18:00 ` Yazen Ghannam [this message]
2022-02-28 16:13 ` [PATCH 02/14] EDAC/amd64: Add get_base_mask() into pvt->ops Naveen Krishna Chatradhi
2022-03-23 17:33 ` Yazen Ghannam
2022-03-23 17:34 ` Borislav Petkov
2022-02-28 16:13 ` [PATCH 03/14] EDAC/amd64: Add prep_chip_selects() " Naveen Krishna Chatradhi
2022-03-23 18:16 ` Yazen Ghannam
2022-02-28 16:13 ` [PATCH 04/14] EDAC/amd64: Add determine_memory_type() " Naveen Krishna Chatradhi
2022-03-23 18:20 ` Yazen Ghannam
2022-02-28 16:13 ` [PATCH 05/14] EDAC/amd64: Add get_ecc_sym_sz() " Naveen Krishna Chatradhi
2022-03-23 18:30 ` Yazen Ghannam
2022-02-28 16:13 ` [PATCH 06/14] EDAC/amd64: Add get_mc_regs() " Naveen Krishna Chatradhi
2022-03-28 16:08 ` Yazen Ghannam
2022-03-31 12:19 ` Chatradhi, Naveen Krishna
2022-04-04 18:19 ` Yazen Ghannam
2022-04-04 18:27 ` Borislav Petkov
2022-02-28 16:13 ` [PATCH 07/14] EDAC/amd64: Add ecc_enabled() " Naveen Krishna Chatradhi
2022-03-28 16:17 ` Yazen Ghannam
2022-02-28 16:13 ` [PATCH 08/14] EDAC/amd64: Add determine_edac_cap() " Naveen Krishna Chatradhi
2022-03-28 16:22 ` Yazen Ghannam
2022-02-28 16:13 ` [PATCH 09/14] EDAC/amd64: Add determine_edac_ctl_cap() " Naveen Krishna Chatradhi
2022-03-28 16:26 ` Yazen Ghannam
2022-02-28 16:13 ` [PATCH 10/14] EDAC/amd64: Add setup_mci_misc_sttrs() " Naveen Krishna Chatradhi
2022-03-28 16:39 ` Yazen Ghannam
2022-02-28 16:13 ` [PATCH 11/14] EDAC/amd64: Add populate_csrows() " Naveen Krishna Chatradhi
2022-03-28 16:47 ` Yazen Ghannam
2022-02-28 16:13 ` [PATCH 12/14] EDAC/amd64: Add dump_misc_regs() " Naveen Krishna Chatradhi
2022-03-28 16:58 ` Yazen Ghannam
2022-02-28 16:13 ` [PATCH 13/14] EDAC/amd64: Add get_cs_mode() " Naveen Krishna Chatradhi
2022-03-28 17:00 ` Yazen Ghannam
2022-02-28 16:13 ` [PATCH 14/14] EDAC/amd64: Add get_umc_error_info() " Naveen Krishna Chatradhi
2022-03-28 17:13 ` Yazen Ghannam
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=YksyMj8mrHJUs+F7@yaz-ubuntu \
--to=yazen.ghannam@amd.com \
--cc=bp@alien8.de \
--cc=linux-edac@vger.kernel.org \
--cc=mchehab@kernel.org \
--cc=mingo@redhat.com \
--cc=muralimk@amd.com \
--cc=nchatrad@amd.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox