qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] util: vfio-helpers: use ARRAY_SIZE in qemu_vfio_init_pci()
@ 2018-11-30  9:53 Li Qiang
  2018-11-30 12:01 ` Philippe Mathieu-Daudé
  2018-12-07 11:15 ` [Qemu-devel] [Qemu-trivial] " Laurent Vivier
  0 siblings, 2 replies; 5+ messages in thread
From: Li Qiang @ 2018-11-30  9:53 UTC (permalink / raw)
  To: laurent, philmd; +Cc: qemu-devel, qemu-trivial, Li Qiang

Cc: qemu-trivial@nongnu.org

Signed-off-by: Li Qiang <liq3ea@gmail.com>
---
 util/vfio-helpers.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/util/vfio-helpers.c b/util/vfio-helpers.c
index cccc9cd42e..342d4a2285 100644
--- a/util/vfio-helpers.c
+++ b/util/vfio-helpers.c
@@ -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;
-- 
2.11.0

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [Qemu-devel] [PATCH] util: vfio-helpers: use ARRAY_SIZE in qemu_vfio_init_pci()
  2018-11-30  9:53 [Qemu-devel] [PATCH] util: vfio-helpers: use ARRAY_SIZE in qemu_vfio_init_pci() Li Qiang
@ 2018-11-30 12:01 ` Philippe Mathieu-Daudé
  2018-11-30 12:58   ` Laurent Vivier
  2018-12-07 11:15 ` [Qemu-devel] [Qemu-trivial] " Laurent Vivier
  1 sibling, 1 reply; 5+ messages in thread
From: Philippe Mathieu-Daudé @ 2018-11-30 12:01 UTC (permalink / raw)
  To: Li Qiang, laurent; +Cc: qemu-devel, qemu-trivial

On 30/11/18 10:53, Li Qiang wrote:
> Cc: qemu-trivial@nongnu.org
> 
> Signed-off-by: Li Qiang <liq3ea@gmail.com>

Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>

> ---
>  util/vfio-helpers.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/util/vfio-helpers.c b/util/vfio-helpers.c
> index cccc9cd42e..342d4a2285 100644
> --- a/util/vfio-helpers.c
> +++ b/util/vfio-helpers.c
> @@ -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;
> 

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [Qemu-devel] [PATCH] util: vfio-helpers: use ARRAY_SIZE in qemu_vfio_init_pci()
  2018-11-30 12:01 ` Philippe Mathieu-Daudé
@ 2018-11-30 12:58   ` Laurent Vivier
  2018-11-30 19:38     ` Michael Tokarev
  0 siblings, 1 reply; 5+ messages in thread
From: Laurent Vivier @ 2018-11-30 12:58 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé, Li Qiang; +Cc: qemu-devel, qemu-trivial

On 30/11/2018 13:01, Philippe Mathieu-Daudé wrote:
> On 30/11/18 10:53, Li Qiang wrote:
>> Cc: qemu-trivial@nongnu.org
>>
>> Signed-off-by: Li Qiang <liq3ea@gmail.com>
> 
> Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
> 
>> ---
>>  util/vfio-helpers.c | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/util/vfio-helpers.c b/util/vfio-helpers.c
>> index cccc9cd42e..342d4a2285 100644
>> --- a/util/vfio-helpers.c
>> +++ b/util/vfio-helpers.c
>> @@ -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;
>>

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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [Qemu-devel] [PATCH] util: vfio-helpers: use ARRAY_SIZE in qemu_vfio_init_pci()
  2018-11-30 12:58   ` Laurent Vivier
@ 2018-11-30 19:38     ` Michael Tokarev
  0 siblings, 0 replies; 5+ messages in thread
From: Michael Tokarev @ 2018-11-30 19:38 UTC (permalink / raw)
  To: Laurent Vivier, Philippe Mathieu-Daudé, Li Qiang
  Cc: qemu-trivial, qemu-devel

30.11.2018 15:58, Laurent Vivier wrote:

>>> -    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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [Qemu-devel] [Qemu-trivial] [PATCH] util: vfio-helpers: use ARRAY_SIZE in qemu_vfio_init_pci()
  2018-11-30  9:53 [Qemu-devel] [PATCH] util: vfio-helpers: use ARRAY_SIZE in qemu_vfio_init_pci() Li Qiang
  2018-11-30 12:01 ` Philippe Mathieu-Daudé
@ 2018-12-07 11:15 ` Laurent Vivier
  1 sibling, 0 replies; 5+ messages in thread
From: Laurent Vivier @ 2018-12-07 11:15 UTC (permalink / raw)
  To: Li Qiang, philmd; +Cc: qemu-trivial, qemu-devel

Le 30/11/2018 à 10:53, Li Qiang a écrit :
> Cc: qemu-trivial@nongnu.org
> 
> Signed-off-by: Li Qiang <liq3ea@gmail.com>
> ---
>  util/vfio-helpers.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/util/vfio-helpers.c b/util/vfio-helpers.c
> index cccc9cd42e..342d4a2285 100644
> --- a/util/vfio-helpers.c
> +++ b/util/vfio-helpers.c
> @@ -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

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2018-12-07 11:15 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-11-30  9:53 [Qemu-devel] [PATCH] util: vfio-helpers: use ARRAY_SIZE in qemu_vfio_init_pci() Li Qiang
2018-11-30 12:01 ` Philippe Mathieu-Daudé
2018-11-30 12:58   ` Laurent Vivier
2018-11-30 19:38     ` Michael Tokarev
2018-12-07 11:15 ` [Qemu-devel] [Qemu-trivial] " Laurent Vivier

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).