Re: [PATCH 07/11] leds: trigger: netdev: reject interval and device store for hw_control

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

 



Hi Christian,

On Thu, Apr 27, 2023 at 02:15:37AM +0200, Christian Marangi wrote:
> Reject interval and device store with hw_control enabled. They are
> currently not supported and MUST be empty with hw_control enabled.
> 
> Signed-off-by: Christian Marangi <ansuelsmth@xxxxxxxxx>
> ---
>  drivers/leds/trigger/ledtrig-netdev.c | 17 +++++++++++++++++
>  1 file changed, 17 insertions(+)
> 
> diff --git a/drivers/leds/trigger/ledtrig-netdev.c b/drivers/leds/trigger/ledtrig-netdev.c
> index 28c4465a2584..8cd876647a27 100644
> --- a/drivers/leds/trigger/ledtrig-netdev.c
> +++ b/drivers/leds/trigger/ledtrig-netdev.c
> @@ -248,6 +255,13 @@ static ssize_t interval_store(struct device *dev,
>  	unsigned long value;
>  	int ret;
>  
> +	mutex_lock(&trigger_data->lock);
> +
> +	if (trigger_data->hw_control) {
> +		size = -EINVAL;
> +		goto out;
> +	}
> +
>  	ret = kstrtoul(buf, 0, &value);
>  	if (ret)
>  		return ret;

You return with the mutex held here. You could do the kstrtoul() before
acquiring the mutex.

Sascha

-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |



[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux