lkml.org 
[lkml]   [2021]   [May]   [29]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: [PATCH v1 08/28] leds: lgm-sso: Put fwnode in any case during ->probe()
On Sat, May 29, 2021 at 12:28 PM Andy Shevchenko
<andy.shevchenko@gmail.com> wrote:
> On Fri, May 28, 2021 at 1:08 PM Pavel Machek <pavel@ucw.cz> wrote:

> > > @@ -734,10 +736,15 @@ static int sso_led_dt_parse(struct sso_led_priv *priv)
> > > if (fw_ssoled) {
> > > ret = __sso_led_dt_parse(priv, fw_ssoled);
> > > if (ret)
> > > - return ret;
> > > + goto err_child_out;
> > > }
> > >
> > > + fwnode_handle_put(fw_ssoled);
> > > return 0;
> > > +
> > > +err_child_out:
> > > + fwnode_handle_put(fw_ssoled);
> > > + return ret;
> > > }
> >
> > Just delete the return and you get the same effect, no? No need to
> > have two exits here.
>
> Okay, I have tried and neither result is better:
> option 1. Add ret = 0, but keep the label
> option 2. Assign 0 to ret at the definition stage and replace return
> with break and remove return 0 (I don't like that ret assigned to 0 in
> the definition block. It usually may lead to subtle errors)
> option 3+. Something I missed which you see can be done?
>
> Which one do you prefer?

I found option 3 which is better and follows your suggestion (I suppose).

--
With Best Regards,
Andy Shevchenko

\
 
 \ /
  Last update: 2021-05-29 12:48    [W:0.099 / U:1.164 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site