Re: [PATCH] staging: most: usb: fix exception handling

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

 



On Mon, May 04, 2020 at 03:44:00PM +0200, Christian Gromm wrote:
> This patch fixes error handling on function parameters.
> 
> Signed-off-by: Christian Gromm <christian.gromm@xxxxxxxxxxxxx>
> ---
>  drivers/staging/most/usb/usb.c | 33 +++++++++++++++++----------------
>  1 file changed, 17 insertions(+), 16 deletions(-)
> 
> diff --git a/drivers/staging/most/usb/usb.c b/drivers/staging/most/usb/usb.c
> index e8c5a8c..e5276524 100644
> --- a/drivers/staging/most/usb/usb.c
> +++ b/drivers/staging/most/usb/usb.c
> @@ -229,14 +229,14 @@ static unsigned int get_stream_frame_size(struct most_channel_config *cfg)
>   */
>  static int hdm_poison_channel(struct most_interface *iface, int channel)
>  {
> -	struct most_dev *mdev = to_mdev(iface);
> +	struct most_dev *mdev;
>  	unsigned long flags;
>  	spinlock_t *lock; /* temp. lock */
>  
>  	if (unlikely(!iface)) {
> -		dev_warn(&mdev->usb_device->dev, "Poison: Bad interface.\n");
> -		return -EIO;
> +		return -EFAULT;

-EFAULT is ONLY for when you have an error with copying memory to/from
userspace.

This should just be -EINVAL, right?

And how can iface ever be NULL?

And why unlikely() there, can you measure the difference with/without
it?  If not, please drop as the compiler/CPU can do it faster than you
ever can.

thanks,

greg k-h
_______________________________________________
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