util: vfio-helpers: use ARRAY_SIZE in qemu_vfio_init_pci()
PATCH 1/1 util: vfio-helpers: use ARRAY_SIZE in qemu_vfio_init_pci()
--- util/vfio-helpers.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
util/vfio-helpers.c +1 -1
@@ -348,7 +348,7 @@ static int qemu_vfio_init_pci(QEMUVFIOState *s, const char *device, goto fail; } -for (i =0 ; i <6 ; i++) { +for (i =0 ; i <ARRAY_SIZE (s->bar_region_info); i++) { ret =qemu_vfio_pci_init_bar (s, i, errp);if (ret) { goto fail;
Signature · 1 line
2.11.0
Quoted 3 lines · Li Qiang
Signed-off-by Li Qiang <[email protected]>
Quoted 18 lines
--- util/vfio-helpers.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)util/vfio-helpers.c +1
-1@@ -348,7 +348,7 @@ static int qemu_vfio_init_pci(QEMUVFIOState *s, const char *device, goto fail; } -for (i =0 ; i <6 ; i++) { +for (i =0 ; i <ARRAY_SIZE (s->bar_region_info); i++) { ret =qemu_vfio_pci_init_bar (s, i, errp);if (ret) { goto fail;
Quoted 19 lines · Philippe Mathieu-Daudé
Quoted 3 lines · Li Qiang
Signed-off-by Li Qiang <[email protected]>Reviewed-by Philippe Mathieu-Daudé <[email protected]>Quoted 12 lines
--- util/vfio-helpers.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)util/vfio-helpers.c +0
-0@@ -348,7 +348,7 @@ static int qemu_vfio_init_pci(QEMUVFIOState *s, const char *device, goto fail; }
Quoted 6 lines
util/vfio-helpers.c static int qemu_vfio_init_pci(QEMUVFIOState *s, const char *device, · line 354
Quoted 6 lines
util/vfio-helpers.c +1
-1-for (i =0 ; i <6 ; i++) { +for (i =0 ; i <ARRAY_SIZE (s->bar_region_info); i++) { ret =qemu_vfio_pci_init_bar (s, i, errp);if (ret) { goto fail;
I'm wondering if adding a #define to define the size of the array and then using it with the for() loop wouldn't be better?
Laurent
Quoted 5 lines · Laurent Vivier
Quoted 2 lines
util/vfio-helpers.c static int qemu_vfio_init_pci(QEMUVFIOState *s, const char *device, · line 351
Quoted 2 lines
util/vfio-helpers.c +1
-1-for (i =0 ; i <6 ; i++) { +for (i =0 ; i <ARRAY_SIZE (s->bar_region_info); i++) {I'm wondering if adding a #define to define the size of the array and then using it with the
for()loop wouldn't be better?
On the other side, it doesn't really matter, one way or another.. It's so.. trivial.. ;)
/mjt
Laurent Vivier
AppliedLe 30/11/2018 à 10:53, Li Qiang a écrit :
Quoted 13 lines
Signed-off-by Li Qiang <[email protected]>--- util/vfio-helpers.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)util/vfio-helpers.c +0
-0
util/vfio-helpers.c static int qemu_vfio_init_pci(QEMUVFIOState *s, const char *device, · line 354
Quoted 8 lines
util/vfio-helpers.c +1
-1@@ -348,7 +348,7 @@ static int qemu_vfio_init_pci(QEMUVFIOState *s, const char *device, goto fail; } -for (i =0 ; i <6 ; i++) { +for (i =0 ; i <ARRAY_SIZE (s->bar_region_info); i++) { ret =qemu_vfio_pci_init_bar (s, i, errp);if (ret) { goto fail;
Applied to my trivial-patches branch.
Thanks,
Laurent