From: "Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>
To: Keith Busch <kbusch@kernel.org>
Cc: Bjorn Helgaas <bhelgaas@google.com>,
linux-pci@vger.kernel.org, LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 2/3] PCI/sysfs: Use __free() in reset_method_store()
Date: Mon, 28 Oct 2024 19:59:58 +0200 (EET) [thread overview]
Message-ID: <8862b34b-26b3-af75-5d23-d765fb41b5d4@linux.intel.com> (raw)
In-Reply-To: <Zx_Pt2ObNKIS8cu2@kbusch-mbp>
[-- Attachment #1: Type: text/plain, Size: 1214 bytes --]
On Mon, 28 Oct 2024, Keith Busch wrote:
> On Mon, Oct 28, 2024 at 07:40:45PM +0200, Ilpo Järvinen wrote:
> > @@ -1430,7 +1431,7 @@ static ssize_t reset_method_store(struct device *dev,
> > const char *buf, size_t count)
> > {
> > struct pci_dev *pdev = to_pci_dev(dev);
> > - char *options, *tmp_options, *name;
> > + char *tmp_options, *name;
> > int m, n;
> > u8 reset_methods[PCI_NUM_RESET_METHODS] = { 0 };
> >
> > @@ -1445,7 +1446,7 @@ static ssize_t reset_method_store(struct device *dev,
> > return count;
> > }
> >
> > - options = kstrndup(buf, count, GFP_KERNEL);
> > + char *options __free(kfree) = kstrndup(buf, count, GFP_KERNEL);
>
> We should avoid mixing declarations with code. Please declare it with
> the cleanup attribute at the top like before, and just initialize it to
> NULL.
Hi,
I don't exactly disagree with you myself and would prefer to keep
declarations at top, but I think as done now is exactly what Bjorn wants
for the specific case where __free() is used. This was discussed earlier
on the list.
If I misunderstood the conclusion of the earlier cleanup related
discussion, can you please correct me Bjorn?
--
i.
next prev parent reply other threads:[~2024-10-28 18:00 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-10-28 17:40 [PATCH 0/3] PCI/sysfs: move to sysfs funcs to pci-sysfs.c & do small tweaks Ilpo Järvinen
2024-10-28 17:40 ` [PATCH 1/3] PCI/sysfs: Move reset related sysfs code to correct file Ilpo Järvinen
2024-10-28 17:40 ` [PATCH 2/3] PCI/sysfs: Use __free() in reset_method_store() Ilpo Järvinen
2024-10-28 17:53 ` Keith Busch
2024-10-28 17:59 ` Ilpo Järvinen [this message]
2024-10-28 18:18 ` Ilpo Järvinen
2024-10-30 23:18 ` Keith Busch
2024-10-28 17:40 ` [PATCH 3/3] PCI/sysfs: Remove unnecessary zero in initializer Ilpo Järvinen
2025-01-15 11:56 ` [PATCH 0/3] PCI/sysfs: move to sysfs funcs to pci-sysfs.c & do small tweaks Krzysztof Wilczyński
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=8862b34b-26b3-af75-5d23-d765fb41b5d4@linux.intel.com \
--to=ilpo.jarvinen@linux.intel.com \
--cc=bhelgaas@google.com \
--cc=kbusch@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pci@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
all inboxes | Powered by JetHome®