From: Sakari Ailus <sakari.ailus@linux.intel.com>
To: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
Cc: Markus Elfring <Markus.Elfring@web.de>,
linux-media@vger.kernel.org, kernel-janitors@vger.kernel.org,
Andy Shevchenko <andriy.shevchenko@linux.intel.com>,
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 09:02:41 +0000 [thread overview]
Message-ID: <ZeGZsRtH6YLx2FiM@kekkonen.localdomain> (raw)
In-Reply-To: <db1d7227-f9a4-42fa-89ba-b484e1260e0b@ideasonboard.com>
Huomenta,
On Fri, Mar 01, 2024 at 10:49:19AM +0200, Tomi Valkeinen wrote:
> Hi,
>
> On 01/03/2024 10:46, Sakari Ailus wrote:
> > Hi Markus,
> >
> > 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 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).
--
Terveisin,
Sakari Ailus
next prev parent reply other threads:[~2024-03-01 9:02 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-03-01 7:46 Markus Elfring
2024-03-01 8:46 ` Sakari Ailus
2024-03-01 8:49 ` Tomi Valkeinen
2024-03-01 9:02 ` Sakari Ailus [this message]
2024-03-01 17:36 ` Andy Shevchenko
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=ZeGZsRtH6YLx2FiM@kekkonen.localdomain \
--to=sakari.ailus@linux.intel.com \
--cc=Markus.Elfring@web.de \
--cc=andriy.shevchenko@linux.intel.com \
--cc=kernel-janitors@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=mchehab@kernel.org \
--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
all inboxes | Powered by JetHome®