From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
To: Sakari Ailus <sakari.ailus@linux.intel.com>
Cc: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>,
Markus Elfring <Markus.Elfring@web.de>,
linux-media@vger.kernel.org, kernel-janitors@vger.kernel.org,
Mauro Carvalho Chehab <mchehab@kernel.org>,
LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] media: i2c: ds90ub960: Delete duplicate source code in ub960_parse_dt_rxports()
Date: Fri, 1 Mar 2024 19:36:17 +0200 [thread overview]
Message-ID: <ZeISEYXTaiyA-b4K@smile.fi.intel.com> (raw)
In-Reply-To: <ZeGZsRtH6YLx2FiM@kekkonen.localdomain>
On Fri, Mar 01, 2024 at 09:02:41AM +0000, Sakari Ailus wrote:
> On Fri, Mar 01, 2024 at 10:49:19AM +0200, Tomi Valkeinen wrote:
> > On 01/03/2024 10:46, Sakari Ailus wrote:
> > > On Fri, Mar 01, 2024 at 08:46:25AM +0100, Markus Elfring wrote:
> > > > From: Markus Elfring <elfring@users.sourceforge.net>
> > > > Date: Fri, 1 Mar 2024 08:23:24 +0100
> > > >
> > > > Avoid the specification of a duplicate fwnode_handle_put() call
> > > > in this function implementation.
> > > >
> > > > Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
> > > > ---
> > > > drivers/media/i2c/ds90ub960.c | 5 +----
> > > > 1 file changed, 1 insertion(+), 4 deletions(-)
> > > >
> > > > diff --git a/drivers/media/i2c/ds90ub960.c b/drivers/media/i2c/ds90ub960.c
> > > > index ffe5f25f8647..eb708ed7b56e 100644
> > > > --- a/drivers/media/i2c/ds90ub960.c
> > > > +++ b/drivers/media/i2c/ds90ub960.c
> > > > @@ -3486,10 +3486,7 @@ static int ub960_parse_dt_rxports(struct ub960_data *priv)
> > > > }
> > > > }
> > > >
> > > > - fwnode_handle_put(links_fwnode);
> > > > -
> > > > - return 0;
> > > > -
> > > > + ret = 0;
> > >
> > > I think it'd be nicer to initialise ret as zero, then you can just drop the
> > > assignment above.
I think tearing apart the assignment and its actual user is not good.
> > I don't like successful execution entering error paths. That's why there's
> > the return 0.
>
> It could be called a common cleanup path as what you really want to do here
> is to put the fwnode handle, independently of whether there was an error.
> I think the current code is of course fine, too.
>
> Soon you can do
>
> struct fwnode_handle *links_fwnode __free(fwnode_handle);
>
> and forget about putting it (but you must need putting it).
Let's wait for the Jonathan's patches to land (v6.9-rc1 I hope) and then
we may modify drivers if needed.
--
With Best Regards,
Andy Shevchenko
next prev parent reply other threads:[~2024-03-01 17:36 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-03-01 7:46 [PATCH] media: i2c: ds90ub960: Delete duplicate source code in ub960_parse_dt_rxports() Markus Elfring
2024-03-01 8:46 ` Sakari Ailus
2024-03-01 8:49 ` Tomi Valkeinen
2024-03-01 9:02 ` Sakari Ailus
2024-03-01 17:36 ` Andy Shevchenko [this message]
2024-03-02 9:13 ` Dan Carpenter
2024-03-02 11:25 ` Markus Elfring
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=ZeISEYXTaiyA-b4K@smile.fi.intel.com \
--to=andriy.shevchenko@linux.intel.com \
--cc=Markus.Elfring@web.de \
--cc=kernel-janitors@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=mchehab@kernel.org \
--cc=sakari.ailus@linux.intel.com \
--cc=tomi.valkeinen@ideasonboard.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