Skip to content

Commit 9a6b090

Browse files
a-darwishRoland Dreier
authored andcommitted
IB/core: Use ARRAY_SIZE macro for mandatory_table
Use ARRAY_SIZE() macro already defined in kernel.h instead of open coding equivalent code. Signed-off-by: Ahmed S. Darwish <[email protected]> Signed-off-by: Roland Dreier <[email protected]>
1 parent 99d4f22 commit 9a6b090

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

drivers/infiniband/core/device.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636
#include <linux/module.h>
3737
#include <linux/string.h>
3838
#include <linux/errno.h>
39+
#include <linux/kernel.h>
3940
#include <linux/slab.h>
4041
#include <linux/init.h>
4142
#include <linux/mutex.h>
@@ -93,7 +94,7 @@ static int ib_device_check_mandatory(struct ib_device *device)
9394
};
9495
int i;
9596

96-
for (i = 0; i < sizeof mandatory_table / sizeof mandatory_table[0]; ++i) {
97+
for (i = 0; i < ARRAY_SIZE(mandatory_table); ++i) {
9798
if (!*(void **) ((void *) device + mandatory_table[i].offset)) {
9899
printk(KERN_WARNING "Device %s is missing mandatory function %s\n",
99100
device->name, mandatory_table[i].name);

0 commit comments

Comments
 (0)