[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <8ece4c88-dbc7-4327-ac2a-0a097fc990d0@moroto.mountain>
Date: Sat, 2 Mar 2024 12:13:59 +0300
From: Dan Carpenter <dan.carpenter@...aro.org>
To: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
Cc: Sakari Ailus <sakari.ailus@...ux.intel.com>,
Tomi Valkeinen <tomi.valkeinen@...asonboard.com>,
Markus Elfring <Markus.Elfring@....de>, linux-media@...r.kernel.org,
kernel-janitors@...r.kernel.org,
Mauro Carvalho Chehab <mchehab@...nel.org>,
LKML <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] media: i2c: ds90ub960: Delete duplicate source code in
ub960_parse_dt_rxports()
On Fri, Mar 01, 2024 at 07:36:17PM +0200, Andy Shevchenko wrote:
> 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@...rs.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@...rs.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.
The __free(fwnode_handle) stuff has already been merged.
We could do some additional work to make a _scoped() macro for
fwnode_handles but here it's function wide so we already have what we
need.
regards,
dan carpenter
Powered by blists - more mailing lists