diff mbox series

[5/8] hw/ide/pci.c: Coding style update to fix checkpatch errors

Message ID 34bdee6ddddd7943b9a68547f46c76f30b9a7e75.1584134074.git.balaton@eik.bme.hu
State New
Headers show
Series Misc hw/ide legacy clean up | expand

Commit Message

BALATON Zoltan March 13, 2020, 9:14 p.m. UTC
Spaces are required around a + operator and if statements should have
braces even for single line. Also make it simpler by reversing the
condition instead of breaking the loop.

Signed-off-by: BALATON Zoltan <balaton@eik.bme.hu>
---
 hw/ide/pci.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

Comments

Philippe Mathieu-Daudé March 14, 2020, 10:05 p.m. UTC | #1
On 3/13/20 10:14 PM, BALATON Zoltan wrote:
> Spaces are required around a + operator and if statements should have
> braces even for single line. Also make it simpler by reversing the
> condition instead of breaking the loop.
> 
> Signed-off-by: BALATON Zoltan <balaton@eik.bme.hu>

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

> ---
>   hw/ide/pci.c | 6 +++---
>   1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/hw/ide/pci.c b/hw/ide/pci.c
> index 4fc76c5225..e0c84392e2 100644
> --- a/hw/ide/pci.c
> +++ b/hw/ide/pci.c
> @@ -485,9 +485,9 @@ void pci_ide_create_devs(PCIDevice *dev, DriveInfo **hd_table)
>       int i;
>   
>       for (i = 0; i < 4; i++) {
> -        if (hd_table[i] == NULL)
> -            continue;
> -        ide_create_drive(d->bus+bus[i], unit[i], hd_table[i]);
> +        if (hd_table[i]) {
> +            ide_create_drive(d->bus + bus[i], unit[i], hd_table[i]);
> +        }
>       }
>   }
>   
>
diff mbox series

Patch

diff --git a/hw/ide/pci.c b/hw/ide/pci.c
index 4fc76c5225..e0c84392e2 100644
--- a/hw/ide/pci.c
+++ b/hw/ide/pci.c
@@ -485,9 +485,9 @@  void pci_ide_create_devs(PCIDevice *dev, DriveInfo **hd_table)
     int i;
 
     for (i = 0; i < 4; i++) {
-        if (hd_table[i] == NULL)
-            continue;
-        ide_create_drive(d->bus+bus[i], unit[i], hd_table[i]);
+        if (hd_table[i]) {
+            ide_create_drive(d->bus + bus[i], unit[i], hd_table[i]);
+        }
     }
 }