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

--
To unsubscribe from this list: send the line "unsubscribe linux-iio" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Input]     [Linux Kernel]     [Linux SCSI]     [X.org]

  Powered by Linux