Message ID | 20200302130715.29440-13-kuhn.chenqun@huawei.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | redundant code: Fix warnings reported by Clang static code analyzer | expand |
On Mon, Mar 02, 2020 at 09:07:14PM +0800, Chen Qun wrote: > The "again" assignment is meaningless before g_assert_not_reached. > In addition, the break statements no longer needs to be after > g_assert_not_reached. > > Clang static code analyzer show warning: > hw/usb/hcd-ehci.c:2108:13: warning: Value stored to 'again' is never read > again = -1; > ^ ~~ > > Reported-by: Euler Robot <euler.robot@huawei.com> > Signed-off-by: Chen Qun <kuhn.chenqun@huawei.com> > Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> Acked-by: Gerd Hoffmann <kraxel@redhat.com>
Le 02/03/2020 à 14:07, Chen Qun a écrit : > The "again" assignment is meaningless before g_assert_not_reached. > In addition, the break statements no longer needs to be after > g_assert_not_reached. > > Clang static code analyzer show warning: > hw/usb/hcd-ehci.c:2108:13: warning: Value stored to 'again' is never read > again = -1; > ^ ~~ > > Reported-by: Euler Robot <euler.robot@huawei.com> > Signed-off-by: Chen Qun <kuhn.chenqun@huawei.com> > Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> > --- > Cc: Gerd Hoffmann <kraxel@redhat.com> > Cc: Philippe Mathieu-Daudé <philmd@redhat.com> > --- > hw/usb/hcd-ehci.c | 3 --- > 1 file changed, 3 deletions(-) > > diff --git a/hw/usb/hcd-ehci.c b/hw/usb/hcd-ehci.c > index 56ab2f457f..29d49c2d7e 100644 > --- a/hw/usb/hcd-ehci.c > +++ b/hw/usb/hcd-ehci.c > @@ -1301,7 +1301,6 @@ static void ehci_execute_complete(EHCIQueue *q) > /* should not be triggerable */ > fprintf(stderr, "USB invalid response %d\n", p->packet.status); > g_assert_not_reached(); > - break; > } > > /* TODO check 4.12 for splits */ > @@ -2105,9 +2104,7 @@ static void ehci_advance_state(EHCIState *ehci, int async) > > default: > fprintf(stderr, "Bad state!\n"); > - again = -1; > g_assert_not_reached(); > - break; > } > > if (again < 0 || itd_count > 16) { > Applied to my trivial-patches branch. Thanks, Laurent
>-----Original Message----- >From: Laurent Vivier [mailto:laurent@vivier.eu] >Sent: Monday, March 9, 2020 8:43 PM >To: Chenqun (kuhn) <kuhn.chenqun@huawei.com>; qemu- >devel@nongnu.org; qemu-trivial@nongnu.org >Cc: peter.maydell@linaro.org; Zhanghailiang ><zhang.zhanghailiang@huawei.com>; Gerd Hoffmann <kraxel@redhat.com>; >Euler Robot <euler.robot@huawei.com>; Philippe Mathieu-Daudé ><philmd@redhat.com> >Subject: Re: [PATCH v3 11/12] usb/hcd-ehci: Remove redundant statements > >Le 02/03/2020 à 14:07, Chen Qun a écrit : >> The "again" assignment is meaningless before g_assert_not_reached. >> In addition, the break statements no longer needs to be after >> g_assert_not_reached. >> >> Clang static code analyzer show warning: >> hw/usb/hcd-ehci.c:2108:13: warning: Value stored to 'again' is never read >> again = -1; >> ^ ~~ >> >> Reported-by: Euler Robot <euler.robot@huawei.com> >> Signed-off-by: Chen Qun <kuhn.chenqun@huawei.com> >> Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> >> --- >> Cc: Gerd Hoffmann <kraxel@redhat.com> >> Cc: Philippe Mathieu-Daudé <philmd@redhat.com> >> --- >> hw/usb/hcd-ehci.c | 3 --- >> 1 file changed, 3 deletions(-) >> >> diff --git a/hw/usb/hcd-ehci.c b/hw/usb/hcd-ehci.c index >> 56ab2f457f..29d49c2d7e 100644 >> --- a/hw/usb/hcd-ehci.c >> +++ b/hw/usb/hcd-ehci.c >> @@ -1301,7 +1301,6 @@ static void ehci_execute_complete(EHCIQueue *q) >> /* should not be triggerable */ >> fprintf(stderr, "USB invalid response %d\n", p->packet.status); >> g_assert_not_reached(); >> - break; >> } >> >> /* TODO check 4.12 for splits */ >> @@ -2105,9 +2104,7 @@ static void ehci_advance_state(EHCIState *ehci, >> int async) >> >> default: >> fprintf(stderr, "Bad state!\n"); >> - again = -1; >> g_assert_not_reached(); >> - break; >> } >> >> if (again < 0 || itd_count > 16) { >> > >Applied to my trivial-patches branch. > Hi, Laurent Gerd has added a patch to the USB queue today. https://patchwork.kernel.org/patch/11405615/ >Thanks, >Laurent
Le 09/03/2020 à 13:52, Chenqun (kuhn) a écrit : > >> -----Original Message----- >> From: Laurent Vivier [mailto:laurent@vivier.eu] >> Sent: Monday, March 9, 2020 8:43 PM >> To: Chenqun (kuhn) <kuhn.chenqun@huawei.com>; qemu- >> devel@nongnu.org; qemu-trivial@nongnu.org >> Cc: peter.maydell@linaro.org; Zhanghailiang >> <zhang.zhanghailiang@huawei.com>; Gerd Hoffmann <kraxel@redhat.com>; >> Euler Robot <euler.robot@huawei.com>; Philippe Mathieu-Daudé >> <philmd@redhat.com> >> Subject: Re: [PATCH v3 11/12] usb/hcd-ehci: Remove redundant statements >> >> Le 02/03/2020 à 14:07, Chen Qun a écrit : >>> The "again" assignment is meaningless before g_assert_not_reached. >>> In addition, the break statements no longer needs to be after >>> g_assert_not_reached. >>> >>> Clang static code analyzer show warning: >>> hw/usb/hcd-ehci.c:2108:13: warning: Value stored to 'again' is never read >>> again = -1; >>> ^ ~~ >>> >>> Reported-by: Euler Robot <euler.robot@huawei.com> >>> Signed-off-by: Chen Qun <kuhn.chenqun@huawei.com> >>> Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> >>> --- >>> Cc: Gerd Hoffmann <kraxel@redhat.com> >>> Cc: Philippe Mathieu-Daudé <philmd@redhat.com> >>> --- >>> hw/usb/hcd-ehci.c | 3 --- >>> 1 file changed, 3 deletions(-) >>> >>> diff --git a/hw/usb/hcd-ehci.c b/hw/usb/hcd-ehci.c index >>> 56ab2f457f..29d49c2d7e 100644 >>> --- a/hw/usb/hcd-ehci.c >>> +++ b/hw/usb/hcd-ehci.c >>> @@ -1301,7 +1301,6 @@ static void ehci_execute_complete(EHCIQueue *q) >>> /* should not be triggerable */ >>> fprintf(stderr, "USB invalid response %d\n", p->packet.status); >>> g_assert_not_reached(); >>> - break; >>> } >>> >>> /* TODO check 4.12 for splits */ >>> @@ -2105,9 +2104,7 @@ static void ehci_advance_state(EHCIState *ehci, >>> int async) >>> >>> default: >>> fprintf(stderr, "Bad state!\n"); >>> - again = -1; >>> g_assert_not_reached(); >>> - break; >>> } >>> >>> if (again < 0 || itd_count > 16) { >>> >> >> Applied to my trivial-patches branch. >> > Hi, Laurent > > Gerd has added a patch to the USB queue today. > > https://patchwork.kernel.org/patch/11405615/ > Ok, removing it from mine. Thanks, Laurent
diff --git a/hw/usb/hcd-ehci.c b/hw/usb/hcd-ehci.c index 56ab2f457f..29d49c2d7e 100644 --- a/hw/usb/hcd-ehci.c +++ b/hw/usb/hcd-ehci.c @@ -1301,7 +1301,6 @@ static void ehci_execute_complete(EHCIQueue *q) /* should not be triggerable */ fprintf(stderr, "USB invalid response %d\n", p->packet.status); g_assert_not_reached(); - break; } /* TODO check 4.12 for splits */ @@ -2105,9 +2104,7 @@ static void ehci_advance_state(EHCIState *ehci, int async) default: fprintf(stderr, "Bad state!\n"); - again = -1; g_assert_not_reached(); - break; } if (again < 0 || itd_count > 16) {