From patchwork Sat Nov 9 12:08:46 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Michael Tokarev X-Patchwork-Id: 842107 Delivered-To: patch@linaro.org Received: by 2002:a5d:6307:0:b0:381:e71e:8f7b with SMTP id i7csp2122686wru; Sat, 9 Nov 2024 04:34:45 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCXNYUbJkoqE6qQD/fqGJbPwfafoEo5aLA7O6kaQi89LFB1q/0ZQ5B7rCxD7ACsLcvTHgjMyXQ==@linaro.org X-Google-Smtp-Source: AGHT+IGgazZM6oORXxqoJm11pzjmN4n4LeMsCZu6hF059o/ccRT+swDcreNCQpE16hN8LadOirak X-Received: by 2002:a05:622a:13ca:b0:461:20b0:9909 with SMTP id d75a77b69052e-4630935ccf7mr88791781cf.29.1731155685122; Sat, 09 Nov 2024 04:34:45 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1731155685; cv=none; d=google.com; s=arc-20240605; b=hPzo4s/qVSssJS/fAaiwYu3G/bhX+CBXEkWUU+PAfIZoVUxMHsVqGimTXoFnJ4dm0k gGEEgrfk3Otnt1++1cYV2+zUh9z8PhOeDi7fWaEF/gVhP1nTpeQWaUsr5KGaiYF7G3u9 T9w5aWa/Ju8mPXqoLGoX1GoZKfh8sSl1DU6Bnd+mArgzre1JIiXyjaa0b/9bpoI0bFOT sftyWFIew2XWlh9MSpLm7DlEtkyWV8azX4IkET3NamixmV4tKmclhlEG4xHZbEVCTV6/ 5onuBh6Feo1Reb1lj1CmQlsevYDgKoqyd6wIf39nRIZJ11cdzTXXahhY9livvcK6PA/j oc2g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from; bh=Kzw6wKLtnA3D9VQWLs0F8NentoT2nlXuxCm2ArPA65k=; fh=M358g5SvjANNFgadsMcrzKZIO38w7xXSD3Bjk/IRyIU=; b=gaYj8PzPtIoXS0ff5wXJsHjP4nMabOQZ5PIWJ6pBBURSoCI4h01uSpUWVROipiGSwh uW2pVvF5V592yZT9TXWPyhOZzB9xs9k2a7i3Cz+BeJkELMsbveRhMZQNQPJ3kjlUbM06 ATehKerfBug9ExS+KdJDrAS4w+Y+9++ECfiRgbq0g+YchMAV6OSuIJmeVAYHrxB/LrV1 FWoXwHjfIfT8pLJnljwdFcoa2G5RlYF/PsnWbt8bkisrAmCQlObCLuEizXcxYNZoI8Q0 LnbWeNeuNr9fVu7yewRX8MECiO6/XtmsQHYYPIVWRWk64dBrcO4kDnozROHaHhkYPXr+ C9+w==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org" Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id d75a77b69052e-462ff5c8063si61994741cf.267.2024.11.09.04.34.44 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sat, 09 Nov 2024 04:34:45 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org" Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1t9kTo-0005cv-08; Sat, 09 Nov 2024 07:22:16 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1t9kRC-0002DB-Ua; Sat, 09 Nov 2024 07:19:35 -0500 Received: from isrv.corpit.ru ([86.62.121.231]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1t9kRB-0005Wk-1q; Sat, 09 Nov 2024 07:19:34 -0500 Received: from tsrv.corpit.ru (tsrv.tls.msk.ru [192.168.177.2]) by isrv.corpit.ru (Postfix) with ESMTP id 88987A1657; Sat, 9 Nov 2024 15:08:09 +0300 (MSK) Received: from tls.msk.ru (mjt.wg.tls.msk.ru [192.168.177.130]) by tsrv.corpit.ru (Postfix) with SMTP id 5086C167FDD; Sat, 9 Nov 2024 15:09:04 +0300 (MSK) Received: (nullmailer pid 3296266 invoked by uid 1000); Sat, 09 Nov 2024 12:09:01 -0000 From: Michael Tokarev To: qemu-devel@nongnu.org Cc: qemu-stable@nongnu.org, =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Nicholas Piggin , Michael Tokarev Subject: [Stable-9.1.2 45/58] hw/ssi/pnv_spi: Return early in transfer() Date: Sat, 9 Nov 2024 15:08:46 +0300 Message-Id: <20241109120901.3295995-45-mjt@tls.msk.ru> X-Mailer: git-send-email 2.39.5 In-Reply-To: References: MIME-Version: 1.0 Received-SPF: pass client-ip=86.62.121.231; envelope-from=mjt@tls.msk.ru; helo=isrv.corpit.ru X-Spam_score_int: -68 X-Spam_score: -6.9 X-Spam_bar: ------ X-Spam_report: (-6.9 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_HI=-5, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org From: Philippe Mathieu-Daudé Return early to simplify next commit. No logical change intended. Cc: qemu-stable@nongnu.org Signed-off-by: Philippe Mathieu-Daudé Signed-off-by: Nicholas Piggin (cherry picked from commit 3feabc18ad4d4bdc178a205b986353a54dbfcf20) Signed-off-by: Michael Tokarev 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(); + if (!rsp_payload) { + return; + } 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); } static inline uint8_t get_seq_index(PnvSpi *s)