diff mbox

scsi: bfa: use ARRAY_SIZE for array sizing calculation on array __pciids

Message ID 20180107231510.7755-1-colin.king@canonical.com (mailing list archive)
State Accepted
Headers show

Commit Message

Colin King Jan. 7, 2018, 11:15 p.m. UTC
From: Colin Ian King <colin.king@canonical.com>

Use the ARRAY_SIZE macro on array __pciids to determine size of the array.
Improvement suggested by coccinelle.

Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
 drivers/scsi/bfa/bfa_core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Martin K. Petersen Jan. 10, 2018, 9:51 p.m. UTC | #1
Colin,

> Use the ARRAY_SIZE macro on array __pciids to determine size of the array.
> Improvement suggested by coccinelle.

Applied to 4.16/scsi-queue. Thanks!
diff mbox

Patch

diff --git a/drivers/scsi/bfa/bfa_core.c b/drivers/scsi/bfa/bfa_core.c
index 3e1caec82554..10a63be92544 100644
--- a/drivers/scsi/bfa/bfa_core.c
+++ b/drivers/scsi/bfa/bfa_core.c
@@ -1957,7 +1957,7 @@  bfa_get_pciids(struct bfa_pciid_s **pciids, int *npciids)
 		{BFA_PCI_VENDOR_ID_BROCADE, BFA_PCI_DEVICE_ID_CT_FC},
 	};
 
-	*npciids = sizeof(__pciids) / sizeof(__pciids[0]);
+	*npciids = ARRAY_SIZE(__pciids);
 	*pciids = __pciids;
 }