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

Dan Carpenter dan.carpenter at oracle.com
Tue Apr 10 23:54:24 PDT 2012


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



More information about the devel mailing list