Re: [PATCH 6/7] iio: light: tsl2583: add locking to sysfs *_store() functions

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

 



On Wed, Oct 19, 2016 at 06:32:09AM -0400, Brian Masney wrote:
> @@ -778,6 +796,8 @@ static ssize_t illuminance0_lux_table_store(struct device *dev,
>  		goto luxable_store_done;
>  	}
>  
> +	mutex_lock(&chip->als_mutex);
> +
>  	if (chip->taos_chip_status == TSL258X_CHIP_WORKING) {
>  		ret = taos_chip_off(indio_dev);
>  		if (ret < 0)
> @@ -794,6 +814,8 @@ static ssize_t illuminance0_lux_table_store(struct device *dev,
>  
>  	ret = len;
>  
> +	mutex_unlock(&chip->als_mutex);
> +
>  luxable_store_done:
>  	return ret;
>  }


HAHAHHA HAHAHAH HAH AHHA HAHHAH AH HAHAHHAHAH AHHAHHAHAHHA HAHA HAHAHAH.

*wipes tear from eye*.  *continues laughing*.

HAHAHAHAHHAHAHA HAHA HAHAHAHA HAHAHA HAHAHAH AHAHAHAHA AHHAHAH.

This patch introduces a return with lock held bug.  All those do nothing
gotos, and we still missed when we actually had to do a "goto unlock".
If every function is special and complicated that reall means that no
functions are special.

Don't do do-nothing gotos.

regards,
dan carpenter

_______________________________________________
devel mailing list
devel@xxxxxxxxxxxxxxxxxxxxxx
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel



[Index of Archives]     [Linux Driver Backports]     [DMA Engine]     [Linux GPIO]     [Linux SPI]     [Video for Linux]     [Linux USB Devel]     [Linux Coverity]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux