Re: [PATCH 4/4] staging: unisys: visornic: convert BUG_ON to dev_err() message

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

 



On Mon, Apr 04, 2016 at 11:31:14PM -0400, David Kershner wrote:
> From: Tim Sell <Timothy.Sell@xxxxxxxxxx>
> 
> The caller of visor_copy_fragsinfo_from_skb() is prepared to log a
> dev_err() message if it fails (by returning a negative value), so we now
> just fail in the one occasion where visor_copy_fragsinfo_from_skb() was
> doing a BUG_ON.
> 
> There was also a problem before where visor_copy_fragsinfo_from_skb() was
> returning a negative to indicate error, yet it was declared to return an
> unsigned value!  So obviously that needed correcting too.
> 
> Signed-off-by: Tim Sell <Timothy.Sell@xxxxxxxxxx>
> Signed-off-by: David Kershner <david.kershner@xxxxxxxxxx>
> ---
>  drivers/staging/unisys/visornic/visornic_main.c | 8 +++-----
>  1 file changed, 3 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/staging/unisys/visornic/visornic_main.c b/drivers/staging/unisys/visornic/visornic_main.c
> index 763738d..cd30d0a 100644
> --- a/drivers/staging/unisys/visornic/visornic_main.c
> +++ b/drivers/staging/unisys/visornic/visornic_main.c
> @@ -209,7 +209,7 @@ static void poll_for_irq(unsigned long v);
>   *	Return value indicates number of entries filled in frags
>   *	Negative values indicate an error.
>   */
> -static unsigned int
> +static int
>  visor_copy_fragsinfo_from_skb(struct sk_buff *skb, unsigned int firstfraglen,
>  			      unsigned int frags_max,
>  			      struct phys_info frags[])
> @@ -269,11 +269,9 @@ visor_copy_fragsinfo_from_skb(struct sk_buff *skb, unsigned int firstfraglen,
>  			 * zero if the frags array is out of room
>  			 * That should never happen because we
>  			 * fail above, if count+numfrags > frags_max.
> -			 * Given that theres no recovery mechanism from putting
> -			 * half a packet in the I/O channel, panic here as this
> -			 * should never happen
>  			 */
> -			BUG_ON(!count);
> +			if (!count)
> +				return -1;

Please return a real error number, don't make up error numbers like -1
:(

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