Messages in this thread | | | Date | Mon, 7 Sep 2009 10:07:57 +0100 | From | Mark Brown <> | Subject | Re: [PATCH 2/2] leds: Add WM831x status LED driver |
| |
On Mon, Sep 07, 2009 at 11:25:07AM +0400, Andrey Panin wrote: > On 248, 09 05, 2009 at 02:09:21PM +0100, Mark Brown wrote:
> > + if (res == NULL) { > > + dev_err(&pdev->dev, "No I/O resource\n"); > > + ret = -EINVAL; > > + goto err;
> Why not return -EINVAL right here ?
For consistency with the rest of the function which uses this style for unwinding (though I see there's a cut'n'pasted return early on which it'd be nice to clean up).
> > +err_led: > > + led_classdev_unregister(&drvdata->cdev);
> This line looks useless and possibly unsafe, led device was not registered.
True.
> Also this part of code can be removed if you move next line up.
I'd prefer to keep the unwinding at the end, it makes the initialisation much easier to modify.
| |