qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Richard Henderson <richard.henderson@linaro.org>
To: qemu-devel@nongnu.org
Subject: Re: [PATCH-for-9.1 v2 3/4] hw/ssi/pnv_spi: Return early in transfer()
Date: Thu, 8 Aug 2024 09:42:04 +1000	[thread overview]
Message-ID: <7c327df7-167c-4f08-b835-b08f8aea975a@linaro.org> (raw)
In-Reply-To: <20240807202804.56038-4-philmd@linaro.org>

On 8/8/24 06:28, Philippe Mathieu-Daudé wrote:
> Return early to simplify next commit.
> No logical change intended.
> 
> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
> ---
>   hw/ssi/pnv_spi.c | 7 ++++---
>   1 file changed, 4 insertions(+), 3 deletions(-)
> 
> diff --git a/hw/ssi/pnv_spi.c b/hw/ssi/pnv_spi.c
> index 13a47f07e7..05e6afc11e 100644
> --- a/hw/ssi/pnv_spi.c
> +++ b/hw/ssi/pnv_spi.c
> @@ -217,6 +217,9 @@ static void transfer(PnvSpi *s, PnvXferBuffer *payload)
>       PnvXferBuffer *rsp_payload = NULL;
>   
>       rsp_payload = pnv_spi_xfer_buffer_new();

this uses g_malloc0

> +    if (!rsp_payload) {
> +        return;
> +    }

so this will never fail.

>       for (int offset = 0; offset < payload->len; offset += s->transfer_len) {
>           tx = 0;
>           for (int i = 0; i < s->transfer_len; i++) {
> @@ -235,9 +238,7 @@ static void transfer(PnvSpi *s, PnvXferBuffer *payload)
>                       (rx >> (8 * (s->transfer_len - 1) - i * 8)) & 0xFF;
>           }
>       }
> -    if (rsp_payload != NULL) {
> -        spi_response(s, s->N1_bits, rsp_payload);
> -    }
> +    spi_response(s, s->N1_bits, rsp_payload);
>   }

The cleanup could simply be this hunk.


r~


  reply	other threads:[~2024-08-07 23:43 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-08-07 20:28 [PATCH-for-9.1 v2 0/4] hw/ssi/pnv_spi: Fixes Coverity CID 1558831 Philippe Mathieu-Daudé
2024-08-07 20:28 ` [PATCH-for-9.1 v2 1/4] MAINTAINERS: Cover PowerPC SPI model in PowerNV section Philippe Mathieu-Daudé
2024-08-07 20:28 ` [PATCH-for-9.1 v2 2/4] hw/ssi/pnv_spi: Match _xfer_buffer_free() with _xfer_buffer_new() Philippe Mathieu-Daudé
2024-08-07 23:44   ` Richard Henderson
2024-08-07 20:28 ` [PATCH-for-9.1 v2 3/4] hw/ssi/pnv_spi: Return early in transfer() Philippe Mathieu-Daudé
2024-08-07 23:42   ` Richard Henderson [this message]
2024-08-07 20:28 ` [PATCH-for-9.1 v2 4/4] hw/ssi/pnv_spi: Fixes Coverity CID 1558831 Philippe Mathieu-Daudé
2024-08-07 20:28   ` Philippe Mathieu-Daudé
2024-08-07 23:45   ` Richard Henderson
2024-09-12 16:55 ` [PATCH-for-9.1 v2 0/4] " Cédric Le Goater
2024-09-13 13:24   ` Chalapathi V
2024-09-13 13:37     ` Cédric Le Goater
2024-09-16 10:04       ` Chalapathi V
2024-11-04  5:51 ` Nicholas Piggin
2024-11-04 11:21   ` Philippe Mathieu-Daudé

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=7c327df7-167c-4f08-b835-b08f8aea975a@linaro.org \
    --to=richard.henderson@linaro.org \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).