From: Bjorn Helgaas Date: Sun, 25 Jun 2006 12:49:03 +0000 (-0700) Subject: [PATCH] CCISS: use ARRAY_SIZE without intermediates X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=5e8621e8bdc2460da516d5f1a5c71d3467ded5d2;p=GitHub%2FLineageOS%2FG12%2Fandroid_kernel_amlogic_linux-4.9.git [PATCH] CCISS: use ARRAY_SIZE without intermediates It's easier to verify loop bounds if the array name is mentioned the for() statement that steps through the array. Signed-off-by: Bjorn Helgaas Acked-by: Jeff Garzik Acked-by: Mike Miller Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- diff --git a/drivers/block/cciss.c b/drivers/block/cciss.c index f7c3c53bd0cd..94e82a229d9f 100644 --- a/drivers/block/cciss.c +++ b/drivers/block/cciss.c @@ -104,8 +104,6 @@ static const struct pci_device_id cciss_pci_device_id[] = { }; MODULE_DEVICE_TABLE(pci, cciss_pci_device_id); -#define NR_PRODUCTS ARRAY_SIZE(products) - /* board_id = Subsystem Device ID & Vendor ID * product = Marketing Name for the board * access = Address of the struct of function pointers @@ -2831,14 +2829,14 @@ static int cciss_pci_init(ctlr_info_t *c, struct pci_dev *pdev) print_cfg_table(c->cfgtable); #endif /* CCISS_DEBUG */ - for(i=0; iproduct_name = products[i].product_name; c->access = *(products[i].access); break; } } - if (i == NR_PRODUCTS) { + if (i == ARRAY_SIZE(products)) { printk(KERN_WARNING "cciss: Sorry, I don't know how" " to access the Smart Array controller %08lx\n", (unsigned long)board_id);