From: z <zhaojunkui2008@126.com>
To: "Vincent MAILHOL" <mailhol.vincent@wanadoo.fr>
Cc: "Marc Kleine-Budde" <mkl@pengutronix.de>,
"Wolfgang Grandegger" <wg@grandegger.com>,
"David S. Miller" <davem@davemloft.net>,
"Jakub Kicinski" <kuba@kernel.org>,
"Paolo Abeni" <pabeni@redhat.com>,
"Stefan Mätje" <stefan.maetje@esd.eu>,
linux-can@vger.kernel.org, netdev@vger.kernel.org,
linux-kernel@vger.kernel.org, bernard@vivo.com
Subject: Re:Re: Re: [PATCH] usb/peak_usb: cleanup code
Date: Wed, 11 May 2022 16:46:37 +0800 (CST) [thread overview]
Message-ID: <1c7b223e.51b2.180b24c78b6.Coremail.zhaojunkui2008@126.com> (raw)
In-Reply-To: <CAMZ6RqKHs4gdcNjVONfOTsHh6ZFEt0qpbEaKqDM7c1Cbc1OLdQ@mail.gmail.com>
At 2022-05-11 16:28:26, "Vincent MAILHOL" <mailhol.vincent@wanadoo.fr> wrote:
>On Wed. 11 May 2022 at 16:11, z <zhaojunkui2008@126.com> wrote:
>> At 2022-05-11 14:44:50, "Marc Kleine-Budde" <mkl@pengutronix.de> wrote:
>> >On 10.05.2022 23:38:38, Bernard Zhao wrote:
>> >> The variable fi and bi only used in branch if (!dev->prev_siblings)
>> >> , fi & bi not kmalloc in else branch, so move kfree into branch
>> >> if (!dev->prev_siblings),this change is to cleanup the code a bit.
>> >
>> >Please move the variable declaration into that scope, too. Adjust the
>> >error handling accordingly.
>>
>> Hi Marc:
>>
>> I am not sure if there is some gap.
>> If we move the variable declaration into that scope, then each error branch has to do the kfree job, like:
>> if (err) {
>> dev_err(dev->netdev->dev.parent,
>> "unable to read %s firmware info (err %d)\n",
>> pcan_usb_pro.name, err);
>> kfree(bi);
>> kfree(fi);
>> kfree(usb_if);
>>
>> return err;
>> }
>> I am not sure if this looks a little less clear?
>> Thanks!
>
>A cleaner way would be to move all the content of the if
>(!dev->prev_siblings) to a new function.
Hi Vincent Mailhol:
Got it.
This seems to be a good idea, i would resubmit one patch V2.
Thanks!
BR//Bernard
>
>Yours sincerely,
>Vincent Mailhol
next prev parent reply other threads:[~2022-05-11 8:48 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-05-11 6:38 [PATCH] usb/peak_usb: cleanup code Bernard Zhao
2022-05-11 6:44 ` Marc Kleine-Budde
2022-05-11 7:11 ` z
2022-05-11 8:28 ` Vincent MAILHOL
2022-05-11 8:46 ` z [this message]
2022-05-11 8:47 ` Marc Kleine-Budde
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=1c7b223e.51b2.180b24c78b6.Coremail.zhaojunkui2008@126.com \
--to=zhaojunkui2008@126.com \
--cc=bernard@vivo.com \
--cc=davem@davemloft.net \
--cc=kuba@kernel.org \
--cc=linux-can@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mailhol.vincent@wanadoo.fr \
--cc=mkl@pengutronix.de \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=stefan.maetje@esd.eu \
--cc=wg@grandegger.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).