Re: [PATCH] usb: udc: core: Use lock for soft_connect

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

 



On Tue, Jan 12, 2021 at 03:26:21PM -0800, Thinh Nguyen wrote:
...
>
> +	mutex_lock(&udc_lock);
>  	if (!udc->driver) {
> +		mutex_unlock(&udc_lock);
>  		dev_err(dev, "soft-connect without a gadget driver\n");
>  		return -EOPNOTSUPP;
>  	}
> @@ -1542,10 +1544,12 @@ static ssize_t soft_connect_store(struct device *dev,
>  		usb_gadget_disconnect(udc->gadget);
>  		usb_gadget_udc_stop(udc);
>  	} else {
> +		mutex_unlock(&udc_lock);
>  		dev_err(dev, "unsupported command '%s'\n", buf);
>  		return -EINVAL;
>  	}
>
> +	mutex_unlock(&udc_lock);
>  	return n;
>  }

Please use "goto out" instead of repeating the mutex unlock line three
times.

Thanks,

--
Ahmed S. Darwish
Linutronix GmbH



[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux