[PATCH v3] i2c: designware: add reset interface

Arnd Bergmann arnd at arndb.de
Fri Jan 6 03:32:52 PST 2017


On Wednesday, January 4, 2017 5:35:19 PM CET Andy Shevchenko wrote:


> > > @@ -270,10 +280,18 @@ static int dw_i2c_plat_probe(struct
> > > platform_device *pdev)
> > >         }
> > >  
> > >         r = i2c_dw_probe(dev);
> > > -       if (r && !dev->pm_runtime_disabled)
> > > -               pm_runtime_disable(&pdev->dev);
> > > +       if (r)
> > > +               goto exit_probe;
> > >  
> > >         return r;
> > > +
> > > +exit_probe:
> > > +       if (!dev->pm_runtime_disabled)
> > > +               pm_runtime_disable(&pdev->dev);
> > > +exit_reset:
> > > +       if (!IS_ERR_OR_NULL(dev->rst))
> > > +               reset_control_assert(dev->rst);
> > > +       return r;
> > > 
> > 
> > try to avoid the IS_ERR_OR_NULL() check, it usually indicates either
> > a bad interface, or that the interface is used wrong.
> 
> Please, fix reset framework first than.
> 
> For my understanding:
> It should return NULL for optional reset control.
> It should not fail on NULL argument.

I think we discussed that a few times. Your suggestion makes sense
to me, but I don't know why we don't already do that, maybe there
is a good reason.

	Arnd



More information about the linux-arm-kernel mailing list