qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] hw/mips/malta: Fix minor dead code issue
@ 2023-04-06 15:37 Peter Maydell
  2023-04-06 15:54 ` Philippe Mathieu-Daudé
  0 siblings, 1 reply; 4+ messages in thread
From: Peter Maydell @ 2023-04-06 15:37 UTC (permalink / raw)
  To: qemu-devel; +Cc: Philippe Mathieu-Daudé, Jiaxun Yang

Coverity points out (in CID 1508390) that write_bootloader has
some dead code, where we assign to 'p' and then in the following
line assign to it again. This happened as a result of the
refactoring in commit cd5066f8618b.

Fix the dead code by removing the 'void *v' variable entirely and
instead adding a cast when calling bl_setup_gt64120_jump_kernel(), as
we do at its other callsite in write_bootloader_nanomips().

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
---
 hw/mips/malta.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/hw/mips/malta.c b/hw/mips/malta.c
index af9021316de..e3be2eea563 100644
--- a/hw/mips/malta.c
+++ b/hw/mips/malta.c
@@ -748,7 +748,6 @@ static void write_bootloader(uint8_t *base, uint64_t run_addr,
                              uint64_t kernel_entry)
 {
     uint32_t *p;
-    void *v;
 
     /* Small bootloader */
     p = (uint32_t *)base;
@@ -785,9 +784,7 @@ static void write_bootloader(uint8_t *base, uint64_t run_addr,
      *
      */
 
-    v = p;
-    bl_setup_gt64120_jump_kernel(&v, run_addr, kernel_entry);
-    p = v;
+    bl_setup_gt64120_jump_kernel((void **)&p, run_addr, kernel_entry);
 
     /* YAMON subroutines */
     p = (uint32_t *) (base + 0x800);
-- 
2.34.1



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

* Re: [PATCH] hw/mips/malta: Fix minor dead code issue
  2023-04-06 15:37 [PATCH] hw/mips/malta: Fix minor dead code issue Peter Maydell
@ 2023-04-06 15:54 ` Philippe Mathieu-Daudé
  2023-05-09 13:07   ` Peter Maydell
  0 siblings, 1 reply; 4+ messages in thread
From: Philippe Mathieu-Daudé @ 2023-04-06 15:54 UTC (permalink / raw)
  To: Peter Maydell, qemu-devel; +Cc: Jiaxun Yang

On 6/4/23 17:37, Peter Maydell wrote:
> Coverity points out (in CID 1508390) that write_bootloader has
> some dead code, where we assign to 'p' and then in the following
> line assign to it again. This happened as a result of the
> refactoring in commit cd5066f8618b.
> 
> Fix the dead code by removing the 'void *v' variable entirely and
> instead adding a cast when calling bl_setup_gt64120_jump_kernel(), as
> we do at its other callsite in write_bootloader_nanomips().
> 
> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
> ---
>   hw/mips/malta.c | 5 +----
>   1 file changed, 1 insertion(+), 4 deletions(-)

Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>

Thank you!


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

* Re: [PATCH] hw/mips/malta: Fix minor dead code issue
  2023-04-06 15:54 ` Philippe Mathieu-Daudé
@ 2023-05-09 13:07   ` Peter Maydell
  2023-05-09 15:37     ` Philippe Mathieu-Daudé
  0 siblings, 1 reply; 4+ messages in thread
From: Peter Maydell @ 2023-05-09 13:07 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé; +Cc: qemu-devel, Jiaxun Yang

On Thu, 6 Apr 2023 at 16:54, Philippe Mathieu-Daudé <philmd@linaro.org> wrote:
>
> On 6/4/23 17:37, Peter Maydell wrote:
> > Coverity points out (in CID 1508390) that write_bootloader has
> > some dead code, where we assign to 'p' and then in the following
> > line assign to it again. This happened as a result of the
> > refactoring in commit cd5066f8618b.
> >
> > Fix the dead code by removing the 'void *v' variable entirely and
> > instead adding a cast when calling bl_setup_gt64120_jump_kernel(), as
> > we do at its other callsite in write_bootloader_nanomips().
> >
> > Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
> > ---
> >   hw/mips/malta.c | 5 +----
> >   1 file changed, 1 insertion(+), 4 deletions(-)
>
> Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>

Are you planning to take this into a mips pullreq?
If not, I can throw it into my next target-arm series.

thanks
-- PMM


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

* Re: [PATCH] hw/mips/malta: Fix minor dead code issue
  2023-05-09 13:07   ` Peter Maydell
@ 2023-05-09 15:37     ` Philippe Mathieu-Daudé
  0 siblings, 0 replies; 4+ messages in thread
From: Philippe Mathieu-Daudé @ 2023-05-09 15:37 UTC (permalink / raw)
  To: Peter Maydell; +Cc: qemu-devel, Jiaxun Yang

On 9/5/23 15:07, Peter Maydell wrote:
> On Thu, 6 Apr 2023 at 16:54, Philippe Mathieu-Daudé <philmd@linaro.org> wrote:
>>
>> On 6/4/23 17:37, Peter Maydell wrote:
>>> Coverity points out (in CID 1508390) that write_bootloader has
>>> some dead code, where we assign to 'p' and then in the following
>>> line assign to it again. This happened as a result of the
>>> refactoring in commit cd5066f8618b.
>>>
>>> Fix the dead code by removing the 'void *v' variable entirely and
>>> instead adding a cast when calling bl_setup_gt64120_jump_kernel(), as
>>> we do at its other callsite in write_bootloader_nanomips().
>>>
>>> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
>>> ---
>>>    hw/mips/malta.c | 5 +----
>>>    1 file changed, 1 insertion(+), 4 deletions(-)
>>
>> Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
> 
> Are you planning to take this into a mips pullreq?
> If not, I can throw it into my next target-arm series.

I'll appreciate if you can take this single patch via your
arm tree. Thanks!



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

end of thread, other threads:[~2023-05-09 15:37 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-04-06 15:37 [PATCH] hw/mips/malta: Fix minor dead code issue Peter Maydell
2023-04-06 15:54 ` Philippe Mathieu-Daudé
2023-05-09 13:07   ` Peter Maydell
2023-05-09 15:37     ` Philippe Mathieu-Daudé

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