Re: [PATCH] gpiolib: fix device_create() result check

From: Alan Cox
Date: Tue Nov 03 2009 - 18:48:01 EST

On Tue, 3 Nov 2009 14:44:01 -0800
Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> wrote:

> On Tue, 20 Oct 2009 20:35:23 +0400
> Sergei Shtylyov <sshtylyov@xxxxxxxxxxxxx> wrote:
> > In case of failure, device_create() returns not NULL but the error code.
> > The current code checks for non-NULL though which causes kernel oops in
> > sysfs_create_group() when device_create() fails. Check for error using
> > IS_ERR() and propagate the error value using PTR_ERR() instead of fixed
> > -ENODEV code returned now...
> Does anyone notice any missing information here?

its what you get for cheap hacks instead of having a ptr_err_t which is a
union so you have to get it right ;)

To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at
Please read the FAQ at