qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v1 1/1] register: Remove unnecessary NULL check
@ 2020-10-02 15:33 Alistair Francis
  2020-10-02 15:55 ` Eduardo Habkost
  0 siblings, 1 reply; 3+ messages in thread
From: Alistair Francis @ 2020-10-02 15:33 UTC (permalink / raw)
  To: qemu-devel, ehabkost; +Cc: peter.maydell, alistair.francis, f4bug, alistair23

This patch fixes CID 1432800 by removing an unnecessary check.

Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
---
 hw/core/register.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/hw/core/register.c b/hw/core/register.c
index 31038bd7cc..9ac9bc6bfe 100644
--- a/hw/core/register.c
+++ b/hw/core/register.c
@@ -258,7 +258,7 @@ static RegisterInfoArray *register_init_block(DeviceState *owner,
         int index = rae[i].addr / data_size;
         RegisterInfo *r = &ri[index];
 
-        if (data + data_size * index == 0 || !&rae[i]) {
+        if (!&rae[i]) {
             continue;
         }
 
-- 
2.28.0



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

* Re: [PATCH v1 1/1] register: Remove unnecessary NULL check
  2020-10-02 15:55 ` Eduardo Habkost
@ 2020-10-02 15:51   ` Alistair Francis
  0 siblings, 0 replies; 3+ messages in thread
From: Alistair Francis @ 2020-10-02 15:51 UTC (permalink / raw)
  To: Eduardo Habkost
  Cc: Peter Maydell, Alistair Francis, qemu-devel@nongnu.org Developers,
	Philippe Mathieu-Daudé

On Fri, Oct 2, 2020 at 8:55 AM Eduardo Habkost <ehabkost@redhat.com> wrote:
>
> On Fri, Oct 02, 2020 at 08:33:40AM -0700, Alistair Francis wrote:
> > This patch fixes CID 1432800 by removing an unnecessary check.
> >
> > Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
> > ---
> >  hw/core/register.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/hw/core/register.c b/hw/core/register.c
> > index 31038bd7cc..9ac9bc6bfe 100644
> > --- a/hw/core/register.c
> > +++ b/hw/core/register.c
> > @@ -258,7 +258,7 @@ static RegisterInfoArray *register_init_block(DeviceState *owner,
> >          int index = rae[i].addr / data_size;
> >          RegisterInfo *r = &ri[index];
> >
> > -        if (data + data_size * index == 0 || !&rae[i]) {
> > +        if (!&rae[i]) {
>
> I thought you were going to remove both checks.

Argh, I didn't realise that. I'll send a v2.

>
> rae can't be NULL, so &rae[i] will never be NULL.

Yep, good point.

Alistair

>
> >              continue;
> >          }
> >
> > --
> > 2.28.0
> >
>
> --
> Eduardo
>


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

* Re: [PATCH v1 1/1] register: Remove unnecessary NULL check
  2020-10-02 15:33 [PATCH v1 1/1] register: Remove unnecessary NULL check Alistair Francis
@ 2020-10-02 15:55 ` Eduardo Habkost
  2020-10-02 15:51   ` Alistair Francis
  0 siblings, 1 reply; 3+ messages in thread
From: Eduardo Habkost @ 2020-10-02 15:55 UTC (permalink / raw)
  To: Alistair Francis; +Cc: peter.maydell, qemu-devel, alistair23, f4bug

On Fri, Oct 02, 2020 at 08:33:40AM -0700, Alistair Francis wrote:
> This patch fixes CID 1432800 by removing an unnecessary check.
> 
> Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
> ---
>  hw/core/register.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/hw/core/register.c b/hw/core/register.c
> index 31038bd7cc..9ac9bc6bfe 100644
> --- a/hw/core/register.c
> +++ b/hw/core/register.c
> @@ -258,7 +258,7 @@ static RegisterInfoArray *register_init_block(DeviceState *owner,
>          int index = rae[i].addr / data_size;
>          RegisterInfo *r = &ri[index];
>  
> -        if (data + data_size * index == 0 || !&rae[i]) {
> +        if (!&rae[i]) {

I thought you were going to remove both checks.

rae can't be NULL, so &rae[i] will never be NULL.

>              continue;
>          }
>  
> -- 
> 2.28.0
> 

-- 
Eduardo



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

end of thread, other threads:[~2020-10-02 16:13 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-10-02 15:33 [PATCH v1 1/1] register: Remove unnecessary NULL check Alistair Francis
2020-10-02 15:55 ` Eduardo Habkost
2020-10-02 15:51   ` Alistair Francis

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