From: Hangyu Hua <hbh25y@gmail.com>
To: Dan Carpenter <dan.carpenter@oracle.com>
Cc: manishc@marvell.com, GR-Linux-NIC-Dev@marvell.com,
coiby.xu@gmail.com, gregkh@linuxfoundation.org,
netdev@vger.kernel.org, linux-staging@lists.linux.dev,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] staging: qlge: add unregister_netdev in qlge_probe
Date: Mon, 21 Feb 2022 09:47:09 +0800 [thread overview]
Message-ID: <a8d5b618-f5ee-686e-d614-dd038004d488@gmail.com> (raw)
In-Reply-To: <20220218120344.GH2407@kadam>
Thanks for your suggesion. I will resubmit later.
On 2022/2/18 20:03, Dan Carpenter wrote:
> On Fri, Feb 18, 2022 at 04:11:30PM +0800, Hangyu Hua wrote:
>> unregister_netdev need to be called when register_netdev succeeds
>> qlge_health_create_reporters fails.
>>
>
> 1) Add a Fixes tag:
>
> Fixes: d8827ae8e22b ("staging: qlge: deal with the case that devlink_health_reporter_create fails")
>
>> Signed-off-by: Hangyu Hua <hbh25y@gmail.com>
>> ---
>> drivers/staging/qlge/qlge_main.c | 4 +++-
>> 1 file changed, 3 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/staging/qlge/qlge_main.c b/drivers/staging/qlge/qlge_main.c
>> index 9873bb2a9ee4..0a199c6d77a1 100644
>> --- a/drivers/staging/qlge/qlge_main.c
>> +++ b/drivers/staging/qlge/qlge_main.c
>> @@ -4611,8 +4611,10 @@ static int qlge_probe(struct pci_dev *pdev,
>> }
>>
>> err = qlge_health_create_reporters(qdev);
>> - if (err)
>> + if (err) {
>> + unregister_netdev(ndev);
>> goto netdev_free;
>> + }
>
> 2) Use a goto to unwind. 3) Release the other pdev stuff as well.
> 4) Clean up the error handling for register_netdev() by using a goto
> as well.
>
> err = register_netdev(ndev);
> if (err) {
> dev_err(&pdev->dev, "net device registration failed.\n");
> goto cleanup_pdev;
> }
>
> err = qlge_health_create_reporters(qdev);
> if (err)
> goto unregister_netdev;
>
> ...
>
> return 0;
>
> unregister_netdev:
> unregister_netdev(ndev);
> cleanup_pdev:
> qlge_release_all(pdev);
> pci_disable_device(pdev);
> netdev_free:
> free_netdev(ndev);
> devlink_free:
> devlink_free(devlink);
>
> return ret;
>
> regards,
> dan carpenter
>
prev parent reply other threads:[~2022-02-21 1:47 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-02-18 8:11 [PATCH] staging: qlge: add unregister_netdev in qlge_probe Hangyu Hua
2022-02-18 12:03 ` Dan Carpenter
2022-02-21 1:47 ` Hangyu Hua [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=a8d5b618-f5ee-686e-d614-dd038004d488@gmail.com \
--to=hbh25y@gmail.com \
--cc=GR-Linux-NIC-Dev@marvell.com \
--cc=coiby.xu@gmail.com \
--cc=dan.carpenter@oracle.com \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-staging@lists.linux.dev \
--cc=manishc@marvell.com \
--cc=netdev@vger.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