> -----Original Message-----
> From: Paolo Bonzini [mailto:paolo.bonz...@gmail.com] On Behalf Of Paolo
> Bonzini
> Sent: Tuesday, May 27, 2014 9:36 PM
> To: Gonglei (Arei); qemu-devel@nongnu.org
> Cc: kw...@redhat.com; peter.crosthwa...@xilinx.com; Huangweidong (C);
> aligu...@amazon.com; m...@redhat.com; Luonengjun; arm...@redhat.com;
> lcapitul...@redhat.com; qiaonuo...@cn.fujitsu.com; av1...@comtv.ru;
> kra...@redhat.com; stefa...@redhat.com; crobi...@redhat.com;
> ler...@redhat.com; afaer...@suse.de
> Subject: Re: [PATCH 6/8] smbus: Fix unreachable code in smb_transaction()
> 
> Il 27/05/2014 03:40, arei.gong...@huawei.com ha scritto:
> > From: Gonglei <arei.gong...@huawei.com>
> >
> > Spotted by Coverity:
> >
> > (1) Event unreachable:  This code cannot be reached: "abort();".
> >
> > 112         abort();
> >
> > Signed-off-by: Gonglei <arei.gong...@huawei.com>
> > ---
> >  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.
> 
But the "break" is unreachable at all case conditions.
All those cases will goto data8/data16/done/error.

Best regards,
-Gonglei


Reply via email to