From: Dan Carpenter <dan.carpenter@oracle.com>
To: Jing Xiangfeng <jingxiangfeng@huawei.com>
Cc: mchehab+huawei@kernel.org, gregkh@linuxfoundation.org,
devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] staging: mfd: hi6421-spmi-pmic: Fix error return in hi6421_spmi_pmic_probe()
Date: Tue, 29 Sep 2020 11:01:07 +0300 [thread overview]
Message-ID: <20200929080107.GX4282@kadam> (raw)
In-Reply-To: <20200929074847.47124-1-jingxiangfeng@huawei.com>
On Tue, Sep 29, 2020 at 03:48:47PM +0800, Jing Xiangfeng wrote:
> Fix to return error code -ENOMEM from the error handling case instead
> of 0.
>
> Signed-off-by: Jing Xiangfeng <jingxiangfeng@huawei.com>
> ---
> drivers/staging/hikey9xx/hi6421-spmi-pmic.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/staging/hikey9xx/hi6421-spmi-pmic.c b/drivers/staging/hikey9xx/hi6421-spmi-pmic.c
> index 64b30d263c8d..4f34a5282970 100644
> --- a/drivers/staging/hikey9xx/hi6421-spmi-pmic.c
> +++ b/drivers/staging/hikey9xx/hi6421-spmi-pmic.c
> @@ -262,8 +262,10 @@ static int hi6421_spmi_pmic_probe(struct spmi_device *pdev)
> hi6421_spmi_pmic_irq_prc(pmic);
>
> pmic->irqs = devm_kzalloc(dev, HISI_IRQ_NUM * sizeof(int), GFP_KERNEL);
> - if (!pmic->irqs)
> + if (!pmic->irqs) {
> + ret = -ENOMEM;
> goto irq_malloc;
It shouldn't do a goto, it should just return directly. The goto
releases an IRQ which isn't acquired until later in the function.
regards,
dan carpenter
prev parent reply other threads:[~2020-09-29 8:01 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-09-29 7:48 [PATCH] staging: mfd: hi6421-spmi-pmic: Fix error return in hi6421_spmi_pmic_probe() Jing Xiangfeng
2020-09-29 8:01 ` Dan Carpenter [this message]
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=20200929080107.GX4282@kadam \
--to=dan.carpenter@oracle.com \
--cc=devel@driverdev.osuosl.org \
--cc=gregkh@linuxfoundation.org \
--cc=jingxiangfeng@huawei.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mchehab+huawei@kernel.org \
/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