* [PATCH] EDAC, mv64x60: Fix an error handling path
@ 2018-01-07 20:54 Christophe JAILLET
2018-01-09 19:19 ` Borislav Petkov
0 siblings, 1 reply; 2+ messages in thread
From: Christophe JAILLET @ 2018-01-07 20:54 UTC (permalink / raw)
To: bp, mchehab; +Cc: linux-edac, linux-kernel, kernel-janitors, Christophe JAILLET
We should not call 'edac_mc_del_mc()' if a corresponding call to
'edac_mc_add_mc()' has not been performed yet.
So here, we should go to err instead of err2 to branch at the right place
of the error handling path.
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
---
drivers/edac/mv64x60_edac.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/edac/mv64x60_edac.c b/drivers/edac/mv64x60_edac.c
index ec5d695bbb72..3c68bb525d5d 100644
--- a/drivers/edac/mv64x60_edac.c
+++ b/drivers/edac/mv64x60_edac.c
@@ -758,7 +758,7 @@ static int mv64x60_mc_err_probe(struct platform_device *pdev)
/* Non-ECC RAM? */
printk(KERN_WARNING "%s: No ECC DIMMs discovered\n", __func__);
res = -ENODEV;
- goto err2;
+ goto err;
}
edac_dbg(3, "init mci\n");
--
2.14.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] EDAC, mv64x60: Fix an error handling path
2018-01-07 20:54 [PATCH] EDAC, mv64x60: Fix an error handling path Christophe JAILLET
@ 2018-01-09 19:19 ` Borislav Petkov
0 siblings, 0 replies; 2+ messages in thread
From: Borislav Petkov @ 2018-01-09 19:19 UTC (permalink / raw)
To: Christophe JAILLET; +Cc: mchehab, linux-edac, linux-kernel, kernel-janitors
On Sun, Jan 07, 2018 at 09:54:00PM +0100, Christophe JAILLET wrote:
> We should not call 'edac_mc_del_mc()' if a corresponding call to
> 'edac_mc_add_mc()' has not been performed yet.
>
> So here, we should go to err instead of err2 to branch at the right place
> of the error handling path.
>
> Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
> ---
> drivers/edac/mv64x60_edac.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/edac/mv64x60_edac.c b/drivers/edac/mv64x60_edac.c
> index ec5d695bbb72..3c68bb525d5d 100644
> --- a/drivers/edac/mv64x60_edac.c
> +++ b/drivers/edac/mv64x60_edac.c
> @@ -758,7 +758,7 @@ static int mv64x60_mc_err_probe(struct platform_device *pdev)
> /* Non-ECC RAM? */
> printk(KERN_WARNING "%s: No ECC DIMMs discovered\n", __func__);
> res = -ENODEV;
> - goto err2;
> + goto err;
> }
>
> edac_dbg(3, "init mci\n");
> --
Applied, thanks.
Btw, while at it, please fix that too:
714 mci = edac_mc_alloc(edac_mc_idx, ARRAY_SIZE(layers), layers,
715 sizeof(struct mv64x60_mc_pdata));
716 if (!mci) {
717 printk(KERN_ERR "%s: No memory for CPU err\n", __func__);
718 devres_release_group(&pdev->dev, mv64x60_mc_err_probe);
719 return -ENOMEM;
720 }
That devres_release_group() happens here and at the function end, at the
"err:" label. So make that above jump to a rls_grp: or so label which
does devres_release_group().
Also the order is wrong - on entry we do:
devres_open_group
edac_mc_alloc
and on exit, the order should be reverse:
edac_mc_free
devres_release_group
and not what we do now:
819 err:
820 devres_release_group(&pdev->dev, mv64x60_mc_err_probe);
821 edac_mc_free(mci);
822 return res;
Thx.
--
Regards/Gruss,
Boris.
Good mailing practices for 400: avoid top-posting and trim the reply.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2018-01-09 19:19 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-01-07 20:54 [PATCH] EDAC, mv64x60: Fix an error handling path Christophe JAILLET
2018-01-09 19:19 ` Borislav Petkov
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).