From patchwork Mon Nov 13 07:09:52 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Su Hui X-Patchwork-Id: 743714 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id AF1C1C4332F for ; Mon, 13 Nov 2023 07:10:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233204AbjKMHKP (ORCPT ); Mon, 13 Nov 2023 02:10:15 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39344 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233145AbjKMHKO (ORCPT ); Mon, 13 Nov 2023 02:10:14 -0500 Received: from mail.nfschina.com (unknown [42.101.60.195]) by lindbergh.monkeyblade.net (Postfix) with SMTP id 10DAC10F4; Sun, 12 Nov 2023 23:10:10 -0800 (PST) Received: from localhost.localdomain (unknown [180.167.10.98]) by mail.nfschina.com (Maildata Gateway V2.8.8) with ESMTPA id 5F51E60511CA1; Mon, 13 Nov 2023 15:10:07 +0800 (CST) X-MD-Sfrom: suhui@nfschina.com X-MD-SrcIP: 180.167.10.98 From: Su Hui To: yanaijie@huawei.com, jinpu.wang@cloud.ionos.com, jejb@linux.ibm.com, martin.petersen@oracle.com, nathan@kernel.org, ndesaulniers@google.com, trix@redhat.com Cc: Su Hui , James.Bottomley@suse.de, aoqingyun@usish.com, tom_peng@usish.com, lindar_liu@usish.com, linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org, llvm@lists.linux.dev, kernel-janitors@vger.kernel.org Subject: [PATCH v2] scsi: pm8001: return error code if no attached dev Date: Mon, 13 Nov 2023 15:09:52 +0800 Message-Id: <20231113070951.122821-1-suhui@nfschina.com> X-Mailer: git-send-email 2.30.2 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org Clang static analyzer complains that value stored to 'res' is never read. Return the error code when sas_find_attached_phy_id() failed. Fixes: dbf9bfe61571 ("[SCSI] pm8001: add SAS/SATA HBA driver") Signed-off-by: Su Hui --- v2: - correct the problem about Fixes tag.(thanks for Jason's reminder) drivers/scsi/pm8001/pm8001_sas.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/scsi/pm8001/pm8001_sas.c b/drivers/scsi/pm8001/pm8001_sas.c index a5a31dfa4512..a1f58bfff5c0 100644 --- a/drivers/scsi/pm8001/pm8001_sas.c +++ b/drivers/scsi/pm8001/pm8001_sas.c @@ -662,6 +662,8 @@ static int pm8001_dev_found_notify(struct domain_device *dev) SAS_ADDR(dev->sas_addr), SAS_ADDR(parent_dev->sas_addr)); res = phy_id; + pm8001_free_dev(pm8001_device); + goto found_out; } else { pm8001_device->attached_phy = phy_id; }