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

From: Dan Carpenter
Date: Wed Oct 19 2016 - 10:49:42 EST


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