From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: Thomas Richard <thomas.richard@bootlin.com>
Cc: Christophe JAILLET <christophe.jaillet@wanadoo.fr>,
Dave Penkler <dpenkler@gmail.com>,
linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org,
linux-staging@lists.linux.dev
Subject: Re: [PATCH v2] staging: gpib: Fix error handling paths in cb_gpib_probe()
Date: Wed, 9 Jul 2025 13:04:23 +0200 [thread overview]
Message-ID: <2025070900-founder-boastful-66cf@gregkh> (raw)
In-Reply-To: <8f8130b2-fec1-48bc-944e-e676a1715c31@bootlin.com>
On Sat, Jul 05, 2025 at 04:17:35PM +0200, Thomas Richard wrote:
> Hi Christophe,
>
> On 7/5/25 11:52 AM, Christophe JAILLET wrote:
> > If cb_gpib_config() fails, 'info' needs to be freed, as already done in the
> > remove function.
> >
> > While at it, remove a pointless comment related to gpib_attach().
> >
> > Fixes: e9dc69956d4d ("staging: gpib: Add Computer Boards GPIB driver")
> > Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
> > ---
> > Changes in v2:
> > - Fix the Fixes tag [Thomas Richard]
> > - Synch with latest -next
> > - no compile tested. I think, thanks to commit 79d2e1919a27
> > ("staging: gpib: fix Makefiles")
> >
> > v1: https://lore.kernel.org/all/459c267de8c9bf48fcb555364930ae7e3cdc798b.1729940596.git.christophe.jaillet@wanadoo.fr/
> >
> > Compile tested only.
> > ---
> > drivers/staging/gpib/cb7210/cb7210.c | 15 +++++++++++----
> > 1 file changed, 11 insertions(+), 4 deletions(-)
> >
> > diff --git a/drivers/staging/gpib/cb7210/cb7210.c b/drivers/staging/gpib/cb7210/cb7210.c
> > index 298ed306189d..3e2397898a9b 100644
> > --- a/drivers/staging/gpib/cb7210/cb7210.c
> > +++ b/drivers/staging/gpib/cb7210/cb7210.c
> > @@ -1184,8 +1184,7 @@ struct local_info {
> > static int cb_gpib_probe(struct pcmcia_device *link)
> > {
> > struct local_info *info;
> > -
> > -// int ret, i;
> > + int ret;
> >
> > /* Allocate space for private device-specific data */
> > info = kzalloc(sizeof(*info), GFP_KERNEL);
>
> You should use devm_kzalloc(). The memory will be automatically freed by
> the core. So no need to call kfree() in case of error during the probe.
> And you can remove the kfree() in cb_gpib_remove().
Some people, myself include, hate the devm_*() apis, so no need to force
them on anyone please :)
thanks,
greg k-h
prev parent reply other threads:[~2025-07-09 11:04 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-07-05 9:52 [PATCH v2] staging: gpib: Fix error handling paths in cb_gpib_probe() Christophe JAILLET
2025-07-05 14:17 ` Thomas Richard
2025-07-09 11:04 ` Greg Kroah-Hartman [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=2025070900-founder-boastful-66cf@gregkh \
--to=gregkh@linuxfoundation.org \
--cc=christophe.jaillet@wanadoo.fr \
--cc=dpenkler@gmail.com \
--cc=kernel-janitors@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-staging@lists.linux.dev \
--cc=thomas.richard@bootlin.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