From: "yukuai (C)" <yukuai3@huawei.com>
To: Jakub Kicinski <kuba@kernel.org>
Cc: <madalin.bucur@nxp.com>, <davem@davemloft.net>,
<florinel.iordache@nxp.com>, <netdev@vger.kernel.org>,
<linux-kernel@vger.kernel.org>, <yi.zhang@huawei.com>
Subject: Re: [PATCH] fsl/fman: add missing put_devcie() call in fman_port_probe()
Date: Tue, 3 Nov 2020 19:09:02 +0800 [thread overview]
Message-ID: <cf2e0c7c-ba3e-b04f-488d-4dd0fcb81f7a@huawei.com> (raw)
In-Reply-To: <20201102173041.7624b7fb@kicinski-fedora-PC1C0HJN.hsd1.ca.comcast.net>
On 2020/11/03 9:30, Jakub Kicinski wrote:
> On Sat, 31 Oct 2020 18:54:18 +0800 Yu Kuai wrote:
>> if of_find_device_by_node() succeed, fman_port_probe() doesn't have a
>> corresponding put_device(). Thus add jump target to fix the exception
>> handling for this function implementation.
>>
>> Fixes: 0572054617f3 ("fsl/fman: fix dereference null return value")
>> Signed-off-by: Yu Kuai <yukuai3@huawei.com>
>
>> diff --git a/drivers/net/ethernet/freescale/fman/fman_port.c b/drivers/net/ethernet/freescale/fman/fman_port.c
>> index d9baac0dbc7d..576ce6df3fce 100644
>> --- a/drivers/net/ethernet/freescale/fman/fman_port.c
>> +++ b/drivers/net/ethernet/freescale/fman/fman_port.c
>> @@ -1799,13 +1799,13 @@ static int fman_port_probe(struct platform_device *of_dev)
>> of_node_put(fm_node);
>> if (!fm_pdev) {
>> err = -EINVAL;
>> - goto return_err;
>> + goto put_device;
>> }
>
>> @@ -1898,6 +1898,8 @@ static int fman_port_probe(struct platform_device *of_dev)
>>
>> return_err:
>> of_node_put(port_node);
>> +put_device:
>> + put_device(&fm_pdev->dev);
>> free_port:
>> kfree(port);
>> return err;
>
> This does not look right. You're jumping to put_device() when fm_pdev
> is NULL?
>
Hi,
oops, it's a silly mistake. Will fix it in V2 patch.
Thanks,
Yu Kuai
> The order of error handling should be the reverse of the order of
> execution of the function.
> .
>
next prev parent reply other threads:[~2020-11-03 11:09 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-10-31 10:54 [PATCH] fsl/fman: add missing put_devcie() call in fman_port_probe() Yu Kuai
2020-11-03 1:30 ` Jakub Kicinski
2020-11-03 11:09 ` yukuai (C) [this message]
2020-11-03 11:23 ` [PATCH V2] " Yu Kuai
2020-11-05 1:31 ` Jakub Kicinski
2020-11-06 21:59 ` Madalin Bucur (OSS)
2020-11-07 9:09 ` [PATCH V3] " Yu Kuai
2020-11-07 22:09 ` Jakub Kicinski
2020-11-09 13:11 ` yukuai (C)
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=cf2e0c7c-ba3e-b04f-488d-4dd0fcb81f7a@huawei.com \
--to=yukuai3@huawei.com \
--cc=davem@davemloft.net \
--cc=florinel.iordache@nxp.com \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=madalin.bucur@nxp.com \
--cc=netdev@vger.kernel.org \
--cc=yi.zhang@huawei.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;
as well as URLs for NNTP newsgroup(s).