qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH 6/8] smbus: Fix unreachable code in smb_transact


From: Gerd Hoffmann
Subject: Re: [Qemu-devel] [PATCH 6/8] smbus: Fix unreachable code in smb_transaction()
Date: Tue, 27 May 2014 17:09:43 +0200

On Di, 2014-05-27 at 15:36 +0200, Paolo Bonzini wrote:
> Il 27/05/2014 03:40, address@hidden ha scritto:
> > From: Gonglei <address@hidden>
> >
> > Spotted by Coverity:
> >
> > (1) Event unreachable:  This code cannot be reached: "abort();".
> >
> > 112         abort();
> >
> > Signed-off-by: Gonglei <address@hidden>
> > ---
> >  hw/i2c/pm_smbus.c | 1 -
> >  1 file changed, 1 deletion(-)
> >
> > diff --git a/hw/i2c/pm_smbus.c b/hw/i2c/pm_smbus.c
> > index fedb5fb..da09eb0 100644
> > --- a/hw/i2c/pm_smbus.c
> > +++ b/hw/i2c/pm_smbus.c
> > @@ -109,7 +109,6 @@ static void smb_transaction(PMSMBus *s)
> >      default:
> >          goto error;
> >      }
> > -    abort();
> 
> This is intentional defensive programming.  A "break" from the switch 
> would be wrong, hence the "abort" here.

Could be replaced with a "g_assert_notreach()" to make that more clear?

cheers,
  Gerd




reply via email to

[Prev in Thread] Current Thread [Next in Thread]