Re: [PATCH] i2c: Fix return value check

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Akinobu,

On Tue, 17 Oct 2006 15:24:49 +0900, Akinobu Mita wrote:
> class_device_create() returns error code as pointer on failure.
> This patch checks the return value of class_device_create() by using IS_ERR().
> 
> Cc: Greg Kroah-Hartman <[email protected]>
> Cc: Jean Delvare <[email protected]>
> Signed-off-by: Akinbou Mita <[email protected]>

Typo ;)

> 
>  drivers/i2c/i2c-dev.c |    4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> Index: 2.6-rc/drivers/i2c/i2c-dev.c
> ===================================================================
> --- 2.6-rc.orig/drivers/i2c/i2c-dev.c
> +++ 2.6-rc/drivers/i2c/i2c-dev.c
> @@ -417,8 +417,8 @@ static int i2cdev_attach_adapter(struct 
>  						 MKDEV(I2C_MAJOR, adap->nr),
>  						 &adap->dev, "i2c-%d",
>  						 adap->nr);
> -	if (!i2c_dev->class_dev) {
> -		res = -ENODEV;
> +	if (IS_ERR(i2c_dev->class_dev)) {
> +		res = PTR_ERR(i2c_dev->class_dev);
>  		goto error;
>  	}
>  	res = class_device_create_file(i2c_dev->class_dev, &class_device_attr_name);

Patch looks correct, however class devices are going away soon, and
this patch will conflict with Greg's work:
http://www.kernel.org/pub/linux/kernel/people/gregkh/gregkh-2.6/patches/driver-class/i2c-dev-device.patch

So your patch should apply on top of Greg's, if still needed after his
changes. It might even be later folded into Greg's patch to make things
easier to handle.

Thanks,
-- 
Jean Delvare
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux