qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] hw/display/sm501: Remove unneeded increment from loop
@ 2023-04-05 15:57 BALATON Zoltan
  2023-04-05 16:31 ` Philippe Mathieu-Daudé
  2023-04-13 21:26 ` Daniel Henrique Barboza
  0 siblings, 2 replies; 3+ messages in thread
From: BALATON Zoltan @ 2023-04-05 15:57 UTC (permalink / raw)
  To: qemu-devel, qemu-ppc; +Cc: Peter Maydell

As Coverity points out (CID 1508621) the calculation to increment i in
the fill fallback loop is ineffective as it is overwritten in next
statement. This was left there by mistake from a previous version but
is not needed in the current approach so remove the superfluous
increment statement.

Reported-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: BALATON Zoltan <balaton@eik.bme.hu>
---
 hw/display/sm501.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/hw/display/sm501.c b/hw/display/sm501.c
index dbabbc4339..0eecd00701 100644
--- a/hw/display/sm501.c
+++ b/hw/display/sm501.c
@@ -901,7 +901,7 @@ static void sm501_2d_operation(SM501State *s)
             /* fallback when pixman failed or we don't want to call it */
             uint8_t *d = s->local_mem + dst_base;
             unsigned int x, y, i;
-            for (y = 0; y < height; y++, i += dst_pitch * bypp) {
+            for (y = 0; y < height; y++) {
                 i = (dst_x + (dst_y + y) * dst_pitch) * bypp;
                 for (x = 0; x < width; x++, i += bypp) {
                     stn_he_p(&d[i], bypp, color);
-- 
2.30.8



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

* Re: [PATCH] hw/display/sm501: Remove unneeded increment from loop
  2023-04-05 15:57 [PATCH] hw/display/sm501: Remove unneeded increment from loop BALATON Zoltan
@ 2023-04-05 16:31 ` Philippe Mathieu-Daudé
  2023-04-13 21:26 ` Daniel Henrique Barboza
  1 sibling, 0 replies; 3+ messages in thread
From: Philippe Mathieu-Daudé @ 2023-04-05 16:31 UTC (permalink / raw)
  To: BALATON Zoltan, qemu-devel, qemu-ppc; +Cc: Peter Maydell

On 5/4/23 17:57, BALATON Zoltan wrote:
> As Coverity points out (CID 1508621) the calculation to increment i in
> the fill fallback loop is ineffective as it is overwritten in next
> statement. This was left there by mistake from a previous version but
> is not needed in the current approach so remove the superfluous
> increment statement.
> 
> Reported-by: Peter Maydell <peter.maydell@linaro.org>
> Signed-off-by: BALATON Zoltan <balaton@eik.bme.hu>
> ---
>   hw/display/sm501.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)

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



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

* Re: [PATCH] hw/display/sm501: Remove unneeded increment from loop
  2023-04-05 15:57 [PATCH] hw/display/sm501: Remove unneeded increment from loop BALATON Zoltan
  2023-04-05 16:31 ` Philippe Mathieu-Daudé
@ 2023-04-13 21:26 ` Daniel Henrique Barboza
  1 sibling, 0 replies; 3+ messages in thread
From: Daniel Henrique Barboza @ 2023-04-13 21:26 UTC (permalink / raw)
  To: BALATON Zoltan, qemu-devel, qemu-ppc; +Cc: Peter Maydell



On 4/5/23 12:57, BALATON Zoltan wrote:
> As Coverity points out (CID 1508621) the calculation to increment i in
> the fill fallback loop is ineffective as it is overwritten in next
> statement. This was left there by mistake from a previous version but
> is not needed in the current approach so remove the superfluous
> increment statement.
> 
> Reported-by: Peter Maydell <peter.maydell@linaro.org>
> Signed-off-by: BALATON Zoltan <balaton@eik.bme.hu>
> ---

Queued in gitlab.com/danielhb/qemu/tree/ppc-next. I'll send it out as soon
as 8.1 dev window opens up.

Thanks,

Daniel

>   hw/display/sm501.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/hw/display/sm501.c b/hw/display/sm501.c
> index dbabbc4339..0eecd00701 100644
> --- a/hw/display/sm501.c
> +++ b/hw/display/sm501.c
> @@ -901,7 +901,7 @@ static void sm501_2d_operation(SM501State *s)
>               /* fallback when pixman failed or we don't want to call it */
>               uint8_t *d = s->local_mem + dst_base;
>               unsigned int x, y, i;
> -            for (y = 0; y < height; y++, i += dst_pitch * bypp) {
> +            for (y = 0; y < height; y++) {
>                   i = (dst_x + (dst_y + y) * dst_pitch) * bypp;
>                   for (x = 0; x < width; x++, i += bypp) {
>                       stn_he_p(&d[i], bypp, color);


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

end of thread, other threads:[~2023-04-13 21:27 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-04-05 15:57 [PATCH] hw/display/sm501: Remove unneeded increment from loop BALATON Zoltan
2023-04-05 16:31 ` Philippe Mathieu-Daudé
2023-04-13 21:26 ` Daniel Henrique Barboza

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