Re: [PATCH 01/01] staging: replace open-coded ARRAY_SIZEs

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

 



On Tue, Apr 10, 2012 at 04:06:41PM -0600, Jim Cromie wrote:
> --- a/drivers/staging/media/as102/as102_usb_drv.c
> +++ b/drivers/staging/media/as102/as102_usb_drv.c
> @@ -367,7 +367,7 @@ static int as102_usb_probe(struct usb_interface *intf,
>  	ENTER();
>  
>  	/* This should never actually happen */
> -	if ((sizeof(as102_usb_id_table) / sizeof(struct usb_device_id)) !=
> +	if (ARRAY_SIZE(as102_usb_id_table) !=
>  	    (sizeof(as102_device_names) / sizeof(const char *))) {
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
I wonder why it missed this one?

If you wanted to send a follow on patch you could just change this
to:
        BUILD_BUG_ON(ARRAY_SIZE(as102_usb_id_table) !=
			ARRAY_SIZE(as102_device_names));

>  		pr_err("Device names table invalid size");
>  		return -EINVAL;

regards,
dan carpenter

_______________________________________________
devel mailing list
devel@xxxxxxxxxxxxxxxxxxxxxx
http://driverdev.linuxdriverproject.org/mailman/listinfo/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