All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ppc/ppc405_boards: Remove unnecessary NULL check
@ 2020-03-20 15:57 Philippe Mathieu-Daudé
  2020-03-20 16:16 ` Markus Armbruster
  2020-03-22  8:46 ` David Gibson
  0 siblings, 2 replies; 5+ messages in thread
From: Philippe Mathieu-Daudé @ 2020-03-20 15:57 UTC (permalink / raw)
  To: qemu-devel
  Cc: Peter Maydell, qemu-trivial, Philippe Mathieu-Daudé,
	Markus Armbruster, qemu-ppc, Alex Bennée, David Gibson

This code is inside the "if (dinfo)" condition, so testing
again here whether it is NULL is unnecessary.

Fixes: dd59bcae7 (Don't size flash memory to match backing image)
Reported-by: Coverity (CID 1421917)
Suggested-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
---
 hw/ppc/ppc405_boards.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/hw/ppc/ppc405_boards.c b/hw/ppc/ppc405_boards.c
index e6bffb9e1a..6198ec1035 100644
--- a/hw/ppc/ppc405_boards.c
+++ b/hw/ppc/ppc405_boards.c
@@ -191,7 +191,7 @@ static void ref405ep_init(MachineState *machine)
         bios_size = 8 * MiB;
         pflash_cfi02_register((uint32_t)(-bios_size),
                               "ef405ep.bios", bios_size,
-                              dinfo ? blk_by_legacy_dinfo(dinfo) : NULL,
+                              blk_by_legacy_dinfo(dinfo),
                               64 * KiB, 1,
                               2, 0x0001, 0x22DA, 0x0000, 0x0000, 0x555, 0x2AA,
                               1);
@@ -459,7 +459,7 @@ static void taihu_405ep_init(MachineState *machine)
         bios_size = 2 * MiB;
         pflash_cfi02_register(0xFFE00000,
                               "taihu_405ep.bios", bios_size,
-                              dinfo ? blk_by_legacy_dinfo(dinfo) : NULL,
+                              blk_by_legacy_dinfo(dinfo),
                               64 * KiB, 1,
                               4, 0x0001, 0x22DA, 0x0000, 0x0000, 0x555, 0x2AA,
                               1);
@@ -494,7 +494,7 @@ static void taihu_405ep_init(MachineState *machine)
     if (dinfo) {
         bios_size = 32 * MiB;
         pflash_cfi02_register(0xfc000000, "taihu_405ep.flash", bios_size,
-                              dinfo ? blk_by_legacy_dinfo(dinfo) : NULL,
+                              blk_by_legacy_dinfo(dinfo),
                               64 * KiB, 1,
                               4, 0x0001, 0x22DA, 0x0000, 0x0000, 0x555, 0x2AA,
                               1);
-- 
2.21.1



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

* Re: [PATCH] ppc/ppc405_boards: Remove unnecessary NULL check
  2020-03-20 15:57 [PATCH] ppc/ppc405_boards: Remove unnecessary NULL check Philippe Mathieu-Daudé
@ 2020-03-20 16:16 ` Markus Armbruster
  2020-03-22  8:46 ` David Gibson
  1 sibling, 0 replies; 5+ messages in thread
From: Markus Armbruster @ 2020-03-20 16:16 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé
  Cc: Peter Maydell, qemu-trivial, qemu-devel, qemu-ppc,
	Alex Bennée, David Gibson

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

> This code is inside the "if (dinfo)" condition, so testing
> again here whether it is NULL is unnecessary.
>
> Fixes: dd59bcae7 (Don't size flash memory to match backing image)
> Reported-by: Coverity (CID 1421917)
> Suggested-by: Peter Maydell <peter.maydell@linaro.org>
> Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
> ---
>  hw/ppc/ppc405_boards.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/hw/ppc/ppc405_boards.c b/hw/ppc/ppc405_boards.c
> index e6bffb9e1a..6198ec1035 100644
> --- a/hw/ppc/ppc405_boards.c
> +++ b/hw/ppc/ppc405_boards.c
> @@ -191,7 +191,7 @@ static void ref405ep_init(MachineState *machine)
>          bios_size = 8 * MiB;
>          pflash_cfi02_register((uint32_t)(-bios_size),
>                                "ef405ep.bios", bios_size,
> -                              dinfo ? blk_by_legacy_dinfo(dinfo) : NULL,
> +                              blk_by_legacy_dinfo(dinfo),
>                                64 * KiB, 1,
>                                2, 0x0001, 0x22DA, 0x0000, 0x0000, 0x555, 0x2AA,
>                                1);
> @@ -459,7 +459,7 @@ static void taihu_405ep_init(MachineState *machine)
>          bios_size = 2 * MiB;
>          pflash_cfi02_register(0xFFE00000,
>                                "taihu_405ep.bios", bios_size,
> -                              dinfo ? blk_by_legacy_dinfo(dinfo) : NULL,
> +                              blk_by_legacy_dinfo(dinfo),
>                                64 * KiB, 1,
>                                4, 0x0001, 0x22DA, 0x0000, 0x0000, 0x555, 0x2AA,
>                                1);
> @@ -494,7 +494,7 @@ static void taihu_405ep_init(MachineState *machine)
>      if (dinfo) {
>          bios_size = 32 * MiB;
>          pflash_cfi02_register(0xfc000000, "taihu_405ep.flash", bios_size,
> -                              dinfo ? blk_by_legacy_dinfo(dinfo) : NULL,
> +                              blk_by_legacy_dinfo(dinfo),
>                                64 * KiB, 1,
>                                4, 0x0001, 0x22DA, 0x0000, 0x0000, 0x555, 0x2AA,
>                                1);

Reviewed-by: Markus Armbruster <armbru@redhat.com>



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

* Re: [PATCH] ppc/ppc405_boards: Remove unnecessary NULL check
  2020-03-20 15:57 [PATCH] ppc/ppc405_boards: Remove unnecessary NULL check Philippe Mathieu-Daudé
  2020-03-20 16:16 ` Markus Armbruster
@ 2020-03-22  8:46 ` David Gibson
  2020-03-22 10:06   ` Peter Maydell
  1 sibling, 1 reply; 5+ messages in thread
From: David Gibson @ 2020-03-22  8:46 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé
  Cc: Peter Maydell, qemu-trivial, qemu-devel, Markus Armbruster,
	qemu-ppc, Alex Bennée

[-- Attachment #1: Type: text/plain, Size: 2480 bytes --]

On Fri, Mar 20, 2020 at 04:57:40PM +0100, Philippe Mathieu-Daudé wrote:
> This code is inside the "if (dinfo)" condition, so testing
> again here whether it is NULL is unnecessary.
> 
> Fixes: dd59bcae7 (Don't size flash memory to match backing image)
> Reported-by: Coverity (CID 1421917)
> Suggested-by: Peter Maydell <peter.maydell@linaro.org>
> Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>

Applied to ppc-for-5.1.

> ---
>  hw/ppc/ppc405_boards.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/hw/ppc/ppc405_boards.c b/hw/ppc/ppc405_boards.c
> index e6bffb9e1a..6198ec1035 100644
> --- a/hw/ppc/ppc405_boards.c
> +++ b/hw/ppc/ppc405_boards.c
> @@ -191,7 +191,7 @@ static void ref405ep_init(MachineState *machine)
>          bios_size = 8 * MiB;
>          pflash_cfi02_register((uint32_t)(-bios_size),
>                                "ef405ep.bios", bios_size,
> -                              dinfo ? blk_by_legacy_dinfo(dinfo) : NULL,
> +                              blk_by_legacy_dinfo(dinfo),
>                                64 * KiB, 1,
>                                2, 0x0001, 0x22DA, 0x0000, 0x0000, 0x555, 0x2AA,
>                                1);
> @@ -459,7 +459,7 @@ static void taihu_405ep_init(MachineState *machine)
>          bios_size = 2 * MiB;
>          pflash_cfi02_register(0xFFE00000,
>                                "taihu_405ep.bios", bios_size,
> -                              dinfo ? blk_by_legacy_dinfo(dinfo) : NULL,
> +                              blk_by_legacy_dinfo(dinfo),
>                                64 * KiB, 1,
>                                4, 0x0001, 0x22DA, 0x0000, 0x0000, 0x555, 0x2AA,
>                                1);
> @@ -494,7 +494,7 @@ static void taihu_405ep_init(MachineState *machine)
>      if (dinfo) {
>          bios_size = 32 * MiB;
>          pflash_cfi02_register(0xfc000000, "taihu_405ep.flash", bios_size,
> -                              dinfo ? blk_by_legacy_dinfo(dinfo) : NULL,
> +                              blk_by_legacy_dinfo(dinfo),
>                                64 * KiB, 1,
>                                4, 0x0001, 0x22DA, 0x0000, 0x0000, 0x555, 0x2AA,
>                                1);

-- 
David Gibson			| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au	| minimalist, thank you.  NOT _the_ _other_
				| _way_ _around_!
http://www.ozlabs.org/~dgibson

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

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

* Re: [PATCH] ppc/ppc405_boards: Remove unnecessary NULL check
  2020-03-22  8:46 ` David Gibson
@ 2020-03-22 10:06   ` Peter Maydell
  2020-03-23  2:34     ` David Gibson
  0 siblings, 1 reply; 5+ messages in thread
From: Peter Maydell @ 2020-03-22 10:06 UTC (permalink / raw)
  To: David Gibson
  Cc: QEMU Trivial, Philippe Mathieu-Daudé,
	QEMU Developers, Markus Armbruster, qemu-ppc, Alex Bennée

On Sun, 22 Mar 2020 at 08:50, David Gibson <david@gibson.dropbear.id.au> wrote:
>
> On Fri, Mar 20, 2020 at 04:57:40PM +0100, Philippe Mathieu-Daudé wrote:
> > This code is inside the "if (dinfo)" condition, so testing
> > again here whether it is NULL is unnecessary.
> >
> > Fixes: dd59bcae7 (Don't size flash memory to match backing image)
> > Reported-by: Coverity (CID 1421917)
> > Suggested-by: Peter Maydell <peter.maydell@linaro.org>
> > Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
>
> Applied to ppc-for-5.1.

This would be OK for 5.0 too at this stage.

thanks
-- PMM


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

* Re: [PATCH] ppc/ppc405_boards: Remove unnecessary NULL check
  2020-03-22 10:06   ` Peter Maydell
@ 2020-03-23  2:34     ` David Gibson
  0 siblings, 0 replies; 5+ messages in thread
From: David Gibson @ 2020-03-23  2:34 UTC (permalink / raw)
  To: Peter Maydell
  Cc: QEMU Trivial, Philippe Mathieu-Daudé,
	QEMU Developers, Markus Armbruster, qemu-ppc, Alex Bennée

[-- Attachment #1: Type: text/plain, Size: 967 bytes --]

On Sun, Mar 22, 2020 at 10:06:13AM +0000, Peter Maydell wrote:
> On Sun, 22 Mar 2020 at 08:50, David Gibson <david@gibson.dropbear.id.au> wrote:
> >
> > On Fri, Mar 20, 2020 at 04:57:40PM +0100, Philippe Mathieu-Daudé wrote:
> > > This code is inside the "if (dinfo)" condition, so testing
> > > again here whether it is NULL is unnecessary.
> > >
> > > Fixes: dd59bcae7 (Don't size flash memory to match backing image)
> > > Reported-by: Coverity (CID 1421917)
> > > Suggested-by: Peter Maydell <peter.maydell@linaro.org>
> > > Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
> >
> > Applied to ppc-for-5.1.
> 
> This would be OK for 5.0 too at this stage.

Understood, I've moved this into the ppc-for-5.0 tree.

> 
> thanks
> -- PMM
> 

-- 
David Gibson			| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au	| minimalist, thank you.  NOT _the_ _other_
				| _way_ _around_!
http://www.ozlabs.org/~dgibson

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

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

end of thread, other threads:[~2020-03-23  3:22 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-03-20 15:57 [PATCH] ppc/ppc405_boards: Remove unnecessary NULL check Philippe Mathieu-Daudé
2020-03-20 16:16 ` Markus Armbruster
2020-03-22  8:46 ` David Gibson
2020-03-22 10:06   ` Peter Maydell
2020-03-23  2:34     ` David Gibson

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.