Received: by 2002:a05:7412:b130:b0:e2:908c:2ebd with SMTP id az48csp2078568rdb; Mon, 20 Nov 2023 00:54:30 -0800 (PST) X-Google-Smtp-Source: AGHT+IE59HWCVNuaUG7yMY7xd36U0hKPt2CnKurpJ15snKkJOJ4svXQIUb3L1R9E6bNwRCbNBtGQ X-Received: by 2002:a17:902:b286:b0:1cc:492c:291b with SMTP id u6-20020a170902b28600b001cc492c291bmr5239312plr.36.1700470470116; Mon, 20 Nov 2023 00:54:30 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700470470; cv=none; d=google.com; s=arc-20160816; b=OcUnJeWfwer/ON5LbAOgGH8xZBu3mxHF3OBvdN9dnn7J+2eNSuOJGVd17Q0izhOJdL KerHTKIUVdCGeqCEba3uGpMyXsQ9KszfEPTlGurwPADxQkjd5jPAjVQbLJfPPsMvkWzw 8qzS1gIwNdDIDREz0Qxnq7JzS9iD/Hu8di1Csmbvp9UB/Ncjv0oiIvMuWIA0qCGqGeMD 5roClkhn43OSChIgpfPJZa6JaCAC4+GRHnuXwwzefZl821rdHFPDzl9EGC9NCDZ3XJqW L26xfrYx9+Ndm+o7Pq4jsjGeyCjzuLT8oszblJ0tz0NYPx+FtY+vZi7331/hY3CBtC/a xOiw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=mghS51PfBcwka0ywPTXVRw2lhZoHyJwB5zI7gmtonxM=; fh=nbyAn4UScH19STeJom2LFEMwLn0zmAxqtEuu2BBmxWI=; b=QR2oTAOqaNLaowYC0y9BSUnRAjL54xw8nd90w81qjgDdcn7y/nMXOMbIYnTMOhXTCk HDxOIcejUs5Vz7CjbAXiqqQ7GvjwNQAVUUCTtmKJJ7GMcr/hjfCsn3fuyGKYTXHZ0sFs G/0QxwEM1DPEiw8QWBJDexZZth6Enq8A/FzJZNUOY+p6F7VoBfrb+VehYMTUlFLwn30t Dpf3BmIe73NvqMCuDoTRWXaW5SYHdGXAC67wfiW8IryArrFmc6smJFH35nt0HYrr1LPC k4fEmxxqpqmQNCCLS5J6Y18aEpzsI9kqtaF5czg+KiH9KlJXbaWqxSEEMYdXzYnYpMxZ eZgA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from groat.vger.email (groat.vger.email. [23.128.96.35]) by mx.google.com with ESMTPS id k8-20020a170902c40800b001cf5d358742si2176865plk.601.2023.11.20.00.54.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 20 Nov 2023 00:54:30 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) client-ip=23.128.96.35; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by groat.vger.email (Postfix) with ESMTP id 90304809C16B; Mon, 20 Nov 2023 00:54:27 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232402AbjKTIyU (ORCPT + 99 others); Mon, 20 Nov 2023 03:54:20 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43422 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232268AbjKTIyS (ORCPT ); Mon, 20 Nov 2023 03:54:18 -0500 Received: from mail.nfschina.com (unknown [42.101.60.195]) by lindbergh.monkeyblade.net (Postfix) with SMTP id 889A49F; Mon, 20 Nov 2023 00:54:14 -0800 (PST) Received: from localhost.localdomain (unknown [180.167.10.98]) by mail.nfschina.com (Maildata Gateway V2.8.8) with ESMTPA id 9910763394DBD; Mon, 20 Nov 2023 16:54:05 +0800 (CST) X-MD-Sfrom: suhui@nfschina.com X-MD-SrcIP: 180.167.10.98 From: Su Hui To: tomas.winkler@intel.com, arnd@arndb.de, gregkh@linuxfoundation.org, nathan@kernel.org, ndesaulniers@google.com, trix@redhat.com Cc: Su Hui , alexander.usyskin@intel.com, linux-kernel@vger.kernel.org, llvm@lists.linux.dev, kernel-janitors@vger.kernel.org Subject: [PATCH] misc: mei: client.c: fix some error code problem in mei_cl_write Date: Mon, 20 Nov 2023 16:53:45 +0800 Message-Id: <20231120085343.157381-1-suhui@nfschina.com> X-Mailer: git-send-email 2.30.2 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-0.8 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on groat.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (groat.vger.email [0.0.0.0]); Mon, 20 Nov 2023 00:54:27 -0800 (PST) Clang static analyzer complains that value stored to 'rets' is never read. Remove some useless code, and let 'buf_len = -EOVERFLOW' to make sure we can return '-EOVERFLOW'. mei_msg_hdr_init() return negative error code, rets should be 'PTR_ERR(mei_hdr)' rather than '-PTR_ERR(mei_hdr)'. Fixes: 0cd7c01a60f8 ("mei: add support for mei extended header.") Fixes: 8c8d964ce90f ("mei: move hbuf_depth from the mei device to the hw modules") Signed-off-by: Su Hui --- drivers/misc/mei/client.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/misc/mei/client.c b/drivers/misc/mei/client.c index 9c8fc87938a7..00dac0a47da0 100644 --- a/drivers/misc/mei/client.c +++ b/drivers/misc/mei/client.c @@ -2011,7 +2011,7 @@ ssize_t mei_cl_write(struct mei_cl *cl, struct mei_cl_cb *cb, unsigned long time mei_hdr = mei_msg_hdr_init(cb); if (IS_ERR(mei_hdr)) { - rets = -PTR_ERR(mei_hdr); + rets = PTR_ERR(mei_hdr); mei_hdr = NULL; goto err; } @@ -2020,19 +2020,17 @@ ssize_t mei_cl_write(struct mei_cl *cl, struct mei_cl_cb *cb, unsigned long time if (rets == 0) { cl_dbg(dev, cl, "No flow control credentials: not sending.\n"); - rets = buf_len; goto out; } if (!mei_hbuf_acquire(dev)) { cl_dbg(dev, cl, "Cannot acquire the host buffer: not sending.\n"); - rets = buf_len; goto out; } hbuf_slots = mei_hbuf_empty_slots(dev); if (hbuf_slots < 0) { - rets = -EOVERFLOW; + buf_len = -EOVERFLOW; goto out; } -- 2.30.2