From patchwork Fri Aug 26 09:18:51 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Patrice CHOTARD X-Patchwork-Id: 12955690 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id EE9E6ECAAA3 for ; Fri, 26 Aug 2022 09:20:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-ID:Date:Subject:CC :To:From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=ojYUR5U5nS4dIj+8P/KMfstsQhfxvWS050CVirEUQ5A=; b=xuBSoAze1bewqw ps1yMcaL5N2eRuwOtZJfPzUmcnRlcLlxrB4xdXTsFHbTL8uXv26lkgdFNnhZmsuJHs0uF3gH+v8fh opTlD5EWSyvgiCNN85vkqez5Rx7gSJVfpYGwRt5iqX0m683Hr8FkIRuzc77AtkLDSgN/GugVtwJJG +tVuWOlu57QtLaQMUIjGILm7htQs7D6q+qrfMqvhimuGtvbPGzLmqxU0Uv1sgYN008AoXxeY7g7MP a1y3SGtr+9MfbU6iAaYwoUpSOHgAstFRT2jF9rJDgEsYuDh4VUy2CTf+wH+QPi59qB3cOdtVY/RTS chaT9wT+NNmeq+KxsGJg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oRVUk-000V08-NK; Fri, 26 Aug 2022 09:19:18 +0000 Received: from mx08-00178001.pphosted.com ([91.207.212.93] helo=mx07-00178001.pphosted.com) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oRVUh-000UmN-Jz for linux-arm-kernel@lists.infradead.org; Fri, 26 Aug 2022 09:19:17 +0000 Received: from pps.filterd (m0046660.ppops.net [127.0.0.1]) by mx07-00178001.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 27Q8XnIa002217; Fri, 26 Aug 2022 11:19:04 +0200 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=foss.st.com; h=from : to : cc : subject : date : message-id : mime-version : content-transfer-encoding : content-type; s=selector1; bh=9gvdPpfWhML/QsrMl+pD+HweNQ2GBnbJdkoZ5Iv84OE=; b=IlHC48Br61AxoVupam3KG+mMws0m+4cuyJJuqO6jZaumyW1J63/3QX/ztiGEinlX3D5x eqzvb0PwBgphdSI/lmaQYfzOKFzd04VDFCKqf5Tv4pXwCj/UtpH+2GUA7ay9THduvBJ/ uZlOWjd4Esx1e35VPX+35kk91pBFSJ2OPxopUQsnIzkQb6lf/ZCsWpIFFxbTqaz/HUuA Ez7VeImJ8GRGI84bmjnq/kf3sxAgLfHQfnFfZAtIfhLs/07It/WmOXm5MpTl0gzfOjES uLCrk09mcekEk2IwvEeHFe+P3cLt7WBbcWeQQFO7OCjboWGPY9mVNWCtfDj9jli5L5uR pw== Received: from beta.dmz-eu.st.com (beta.dmz-eu.st.com [164.129.1.35]) by mx07-00178001.pphosted.com (PPS) with ESMTPS id 3j5h4wn6g9-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 26 Aug 2022 11:19:04 +0200 Received: from euls16034.sgp.st.com (euls16034.sgp.st.com [10.75.44.20]) by beta.dmz-eu.st.com (STMicroelectronics) with ESMTP id 172CE10002A; Fri, 26 Aug 2022 11:19:03 +0200 (CEST) Received: from Webmail-eu.st.com (shfdag1node1.st.com [10.75.129.69]) by euls16034.sgp.st.com (STMicroelectronics) with ESMTP id 90099217B72; Fri, 26 Aug 2022 11:19:03 +0200 (CEST) Received: from localhost (10.75.127.119) by SHFDAG1NODE1.st.com (10.75.129.69) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256) id 15.1.2308.20; Fri, 26 Aug 2022 11:19:03 +0200 From: To: Mark Brown CC: , , , , , , Dan Carpenter Subject: spi: stm32-qspi: Fix stm32_qspi_transfer_one_message() error path Date: Fri, 26 Aug 2022 11:18:51 +0200 Message-ID: <20220826091851.1393266-1-patrice.chotard@foss.st.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 X-Originating-IP: [10.75.127.119] X-ClientProxiedBy: GPXDAG2NODE5.st.com (10.75.127.69) To SHFDAG1NODE1.st.com (10.75.129.69) X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.895,Hydra:6.0.517,FMLib:17.11.122.1 definitions=2022-08-26_04,2022-08-25_01,2022-06-22_01 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220826_021916_025104_C6A190AB X-CRM114-Status: GOOD ( 15.63 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org From: Patrice Chotard The patch a557fca630cc: "spi: stm32_qspi: Add transfer_one_message() spi callback" from Aug 23, 2022, leads to the following Smatch static checker warning: drivers/spi/spi-stm32-qspi.c:627 stm32_qspi_transfer_one_message() error: uninitialized symbol 'ret'.Fix the following Smatch static checker warning: Fixes: a557fca630cc ("spi: stm32_qspi: Add transfer_one_message() spi callback") Reported-by: Dan Carpenter Signed-off-by: Patrice Chotard --- drivers/spi/spi-stm32-qspi.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/spi/spi-stm32-qspi.c b/drivers/spi/spi-stm32-qspi.c index 92459daca95f..679fd1c34f7e 100644 --- a/drivers/spi/spi-stm32-qspi.c +++ b/drivers/spi/spi-stm32-qspi.c @@ -562,7 +562,7 @@ static int stm32_qspi_transfer_one_message(struct spi_controller *ctrl, struct spi_transfer *transfer; struct spi_device *spi = msg->spi; struct spi_mem_op op; - int ret; + int ret = 0; if (!spi->cs_gpiod) return -EOPNOTSUPP; @@ -592,8 +592,10 @@ static int stm32_qspi_transfer_one_message(struct spi_controller *ctrl, dummy_bytes = transfer->len; /* if happens, means that message is not correctly built */ - if (list_is_last(&transfer->transfer_list, &msg->transfers)) + if (list_is_last(&transfer->transfer_list, &msg->transfers)) { + ret = -EINVAL; goto end_of_transfer; + } transfer = list_next_entry(transfer, transfer_list); }