lkml.org 
[lkml]   [2009]   [Sep]   [7]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [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.


\
 
 \ /
  Last update: 2009-09-07 11:11    [W:0.058 / U:3.624 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site