[PATCH] jbt6k74: error checking and possible cleanup.

Arnaud Patard (Rtp) arnaud.patard at rtp-net.org
Sat Mar 24 13:36:40 CET 2007


Stefan Schmidt <stefan at datenfreihafen.org> writes:

> Hello.

Hi,

>
> The two attached patches have some fixes for the LCM driver.
>
> 1. device_create_file() can fail. Check return value and report.
>
> 2. In the register init some three settings were called twice. I guess
>    it's a copy'and'paste error. The data sheet states only one
>    setting. If this works around a harware bug we should comment it.
>
> regards
> Stefan Schmidt
>
> Index: linux-2.6.20.2/drivers/spi/jbt6k74.c
> ===================================================================
> --- linux-2.6.20.2.orig/drivers/spi/jbt6k74.c	2007-03-23 03:14:26.000000000 +0100
> +++ linux-2.6.20.2/drivers/spi/jbt6k74.c	2007-03-23 03:20:26.000000000 +0100
> @@ -445,11 +445,26 @@
>  	}
>  	jbt6k74_display_onoff(jbt, 1);
>  
> -	device_create_file(&spi->dev, &dev_attr_state);
> -	device_create_file(&spi->dev, &dev_attr_gamma_fine1);
> -	device_create_file(&spi->dev, &dev_attr_gamma_fine2);
> -	device_create_file(&spi->dev, &dev_attr_gamma_inclination);
> -	device_create_file(&spi->dev, &dev_attr_gamma_blue_offset);
> +	rc = device_create_file(&spi->dev, &dev_attr_state);
> +	if (rc < 0) {
> +		printk(KERN_WARNING "jbt6k74: creating sysfs file failed\n");
> +	}
> +	rc = device_create_file(&spi->dev, &dev_attr_gamma_fine1);
> +	if (rc < 0) {
> +		printk(KERN_WARNING "jbt6k74: creating sysfs file failed\n");
> +	}
> +	rc = device_create_file(&spi->dev, &dev_attr_gamma_fine2);
> +	if (rc < 0) {
> +		printk(KERN_WARNING "jbt6k74: creating sysfs file failed\n");
> +	}
> +	rc = device_create_file(&spi->dev, &dev_attr_gamma_inclination);
> +	if (rc < 0) {
> +		printk(KERN_WARNING "jbt6k74: creating sysfs file failed\n");
> +	}
> +	rc = device_create_file(&spi->dev, &dev_attr_gamma_blue_offset);
> +	if (rc < 0) {
> +		printk(KERN_WARNING "jbt6k74: creating sysfs file failed\n");
> +	}


doh... 5 calls to device_create_file() ... now, with the checks, that
begins to be ugly. Please consider the use of sysfs_create_group()
instead. 


Regards,
Arnaud





More information about the openmoko-kernel mailing list