From: Michael Ellerman <mpe@ellerman.id.au>
To: Hangyu Hua <hbh25y@gmail.com>,
christophe.leroy@csgroup.eu, benh@kernel.crashing.org,
paulus@samba.org, peng.hao2@zte.com.cn, wen.yang99@zte.com.cn
Cc: linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org,
Hangyu Hua <hbh25y@gmail.com>
Subject: Re: [PATCH] powerpc: 8xx: fix a return value error in mpc8xx_pic_init
Date: Wed, 09 Mar 2022 14:24:39 +1100 [thread overview]
Message-ID: <87o82fn6yw.fsf@mpe.ellerman.id.au> (raw)
In-Reply-To: <20220223070223.26845-1-hbh25y@gmail.com>
Hangyu Hua <hbh25y@gmail.com> writes:
> mpc8xx_pic_init() should return -ENOMEM instead of 0 when
> irq_domain_add_linear() return NULL. This cause mpc8xx_pics_init to continue
> executing even if mpc8xx_pic_host is NULL.
>
> Fixes: cc76404feaed ("powerpc/8xx: Fix possible device node reference leak")
> Signed-off-by: Hangyu Hua <hbh25y@gmail.com>
> ---
> arch/powerpc/platforms/8xx/pic.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/arch/powerpc/platforms/8xx/pic.c b/arch/powerpc/platforms/8xx/pic.c
> index f2ba837249d6..04a6abf14c29 100644
> --- a/arch/powerpc/platforms/8xx/pic.c
> +++ b/arch/powerpc/platforms/8xx/pic.c
> @@ -153,6 +153,7 @@ int __init mpc8xx_pic_init(void)
Expanding the context:
siu_reg = ioremap(res.start, resource_size(&res));
if (siu_reg == NULL) {
ret = -EINVAL;
goto out;
}
mpc8xx_pic_host = irq_domain_add_linear(np, 64, &mpc8xx_pic_host_ops, NULL);
> if (mpc8xx_pic_host == NULL) {
> printk(KERN_ERR "MPC8xx PIC: failed to allocate irq host!\n");
> ret = -ENOMEM;
> + goto out;
> }
>
> ret = 0;
>
out:
of_node_put(np);
return ret;
}
Proper error cleanup should also undo the ioremap() if
irq_domain_add_linear() fails.
cheers
next prev parent reply other threads:[~2022-03-09 3:24 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-02-23 7:02 Hangyu Hua
2022-03-07 1:41 ` Hangyu Hua
2022-03-08 15:00 ` Christophe Leroy
2022-03-09 3:24 ` Michael Ellerman [this message]
2022-03-09 7:21 ` Christophe Leroy
2022-03-09 10:46 ` Michael Ellerman
2022-03-09 11:13 ` Christophe Leroy
2022-03-09 23:16 ` Michael Ellerman
2022-03-12 10:29 ` Michael Ellerman
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=87o82fn6yw.fsf@mpe.ellerman.id.au \
--to=mpe@ellerman.id.au \
--cc=benh@kernel.crashing.org \
--cc=christophe.leroy@csgroup.eu \
--cc=hbh25y@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=paulus@samba.org \
--cc=peng.hao2@zte.com.cn \
--cc=wen.yang99@zte.com.cn \
/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
all inboxes | Powered by JetHome®