From patchwork Thu Apr 8 06:18:49 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: "Leizhen \(ThunderTown\)" X-Patchwork-Id: 417403 Delivered-To: patch@linaro.org Received: by 2002:a02:8562:0:0:0:0:0 with SMTP id g89csp261268jai; Wed, 7 Apr 2021 23:19:31 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzuKWYyfDhvEs/MYCEJHhNZXv1M68LYXc8AZ8dvQsinaBr3Sb/mpzONsh2QWDiYlOiIJk75 X-Received: by 2002:a50:d7d7:: with SMTP id m23mr9079540edj.378.1617862771260; Wed, 07 Apr 2021 23:19:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1617862771; cv=none; d=google.com; s=arc-20160816; b=xUPlv53ek2rWCAqYaA780QLNn05U/nGgx6zCFRMek4sZ0UIN5xg+JQtVF/J3wQ3Zk+ 1hbDWK9eMxwurCoMr6F9XUKkf1zeRArxR+PC5ZyH8Lhjv46QKwp61tnEJp61w8awfMF1 V/5nm9gjgxKHWJ67w6o1QKdK7EMAzEkB5eNAfAAdWd0M0iBxbaIRU/KGgFT73nI8yLj3 uEOtKy2kRXYqUb6z3H5aCU7KTHD6Jmpa2KRiO6yPHGJm0MZEpIojZLBxMuTFGUwpYCA8 1YLIxOYX/f6lMbPqRG253HB14cOeuykteEQdSehxo3hmCZ0Qy0qB13qfIEujKTcfF1cq epoQ== 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 :references:in-reply-to:message-id:date:subject:cc:to:from; bh=Mk9NvDnxxswELjQfoOcFZd06G//Gy/RlgNvBa9d9AZc=; b=o4aOu++iQr/Z8eni/B5SmmAakloszdEAIBAv1hVvhGdOyhOCVRjpmVSkl5OBdd8u3g 242qoP7R5qkTWrHEfCbxKIK/EkLdI0fXxRxZEFKCwGyjKGHd1eSqDMwbgv9QQcW3fSaT Jk675FyLxxZfVLssBsQNaFffRNQsmWsblv0h6/djDeKxIA9JkKgWnIeFnbPr87z/QWg9 WkPmJflaa26NFSfFqBCaCe1mw07Y84u6mTi80Yfl929VUh/urpVbQj+NAZfzkLT6j2/v wrEPoo1fxGtyOllsxNV2Kh0PzNQ2flFAe221n8hG94xTTlQugsUsgERXF4ra+7Bdwsg3 1XoA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-scsi-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-scsi-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=huawei.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id hq19si21496540ejc.88.2021.04.07.23.19.31 for ; Wed, 07 Apr 2021 23:19:31 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-scsi-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-scsi-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-scsi-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230298AbhDHGTj (ORCPT ); Thu, 8 Apr 2021 02:19:39 -0400 Received: from szxga05-in.huawei.com ([45.249.212.191]:16036 "EHLO szxga05-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231126AbhDHGT3 (ORCPT ); Thu, 8 Apr 2021 02:19:29 -0400 Received: from DGGEMS404-HUB.china.huawei.com (unknown [172.30.72.59]) by szxga05-in.huawei.com (SkyGuard) with ESMTP id 4FG9y66bK6zPnyy; Thu, 8 Apr 2021 14:16:30 +0800 (CST) Received: from thunder-town.china.huawei.com (10.174.179.202) by DGGEMS404-HUB.china.huawei.com (10.3.19.204) with Microsoft SMTP Server id 14.3.498.0; Thu, 8 Apr 2021 14:19:07 +0800 From: Zhen Lei To: Sathya Prakash , Sreekanth Reddy , Suganath Prabu Subramani , "MPT-FusionLinux . pdl" , linux-scsi , linux-kernel CC: Zhen Lei Subject: [PATCH 1/3] scsi: mptfusion: Remove unused local variable 'time_count' Date: Thu, 8 Apr 2021 14:18:49 +0800 Message-ID: <20210408061851.3089-2-thunder.leizhen@huawei.com> X-Mailer: git-send-email 2.26.0.windows.1 In-Reply-To: <20210408061851.3089-1-thunder.leizhen@huawei.com> References: <20210408061851.3089-1-thunder.leizhen@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.174.179.202] X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org Fixes the following W=1 kernel build warning: drivers/message/fusion/mptctl.c: In function ‘mptctl_do_taskmgmt: drivers/message/fusion/mptctl.c:324:17: warning: variable ‘time_count’ set but not used [-Wunused-but-set-variable] Fixes: 7d757f185540 ("[SCSI] mptfusion: Updated SCSI IO IOCTL error handling.") Reported-by: Hulk Robot Signed-off-by: Zhen Lei --- drivers/message/fusion/mptctl.c | 2 -- 1 file changed, 2 deletions(-) -- 2.21.1 diff --git a/drivers/message/fusion/mptctl.c b/drivers/message/fusion/mptctl.c index 24aebad60366..0a9321239e76 100644 --- a/drivers/message/fusion/mptctl.c +++ b/drivers/message/fusion/mptctl.c @@ -321,7 +321,6 @@ mptctl_do_taskmgmt(MPT_ADAPTER *ioc, u8 tm_type, u8 bus_id, u8 target_id) int ii; int retval; unsigned long timeout; - unsigned long time_count; u16 iocstatus; @@ -383,7 +382,6 @@ mptctl_do_taskmgmt(MPT_ADAPTER *ioc, u8 tm_type, u8 bus_id, u8 target_id) ioc->name, tm_type, timeout)); INITIALIZE_MGMT_STATUS(ioc->taskmgmt_cmds.status) - time_count = jiffies; if ((ioc->facts.IOCCapabilities & MPI_IOCFACTS_CAPABILITY_HIGH_PRI_Q) && (ioc->facts.MsgVersion >= MPI_VERSION_01_05)) mpt_put_msg_frame_hi_pri(mptctl_taskmgmt_id, ioc, mf); From patchwork Thu Apr 8 06:18:50 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: "Leizhen \(ThunderTown\)" X-Patchwork-Id: 417402 Delivered-To: patch@linaro.org Received: by 2002:a02:8562:0:0:0:0:0 with SMTP id g89csp261264jai; Wed, 7 Apr 2021 23:19:30 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxc5KNLZQlC/HLYlztXYbeD0ULxqGUz0tzeXKO5onRjEpel0/IZCGXZAlb+dY5jRreJWgYH X-Received: by 2002:a17:907:c28:: with SMTP id ga40mr8147677ejc.444.1617862770830; Wed, 07 Apr 2021 23:19:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1617862770; cv=none; d=google.com; s=arc-20160816; b=vC/1vhbVHxEDkBSLNOYfxBuwDeeFjGhTMLcNqyd9y/fiIKMUtNURbxVv+ayFdkKudh GkXvRUzsirdBRj7sjXxTnlA0oVDBYUFLx652qeKZ1Y3yFbjZKwv8Jc1m3xWsGmkIgi5W A+EQ7MYJogb5D75j5in1m9owpf2uWR2Mn0+TGtF//znxs0VcedgoE9kkUSfDeW1+g4qU 7WorFRjSUNaoy1pA2GFbzZJ+dv/wPKzSH+jJdJwwUiNWiUwkaB5rnE/KqGc3h7iBakNY qomD8HqyLJgAgecgAIRNlheHjhOGrWhSH1PoNR2a7Fq+sq2hNzEwHsoGoQyG737bzpCE Hq6g== 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 :references:in-reply-to:message-id:date:subject:cc:to:from; bh=hUzdlzaZWigAIRqyBtk0LIab/V+HKrxdnDyIxKsg4sU=; b=WM+XKK5CzoaCvPkBaPakk94n/mH6ovSAZI6fqv9Z88gncfp9nrJHB0y/J/ymiiQh0V 9AM1qWfIc2apMMxdnqjDuQ/dWfUVeEqJffNfgwwSt5IOOCjo1SqpDikO6pf92i+2V+P/ GdCRGhPBsS0pojdfhMJQZooihNLwolRQBihEYfgwfpFW5qNqOXby8DmHn36vPF287p1L o8aEc2U2cmqnExGoEludhH4iiBA2se6WkF2uUL29uRZM/ee8WHKt72AweGSRXGSganIw 01JcQrNavgdBGYliYcCpom1T0qV32U5BCMXhok99pRS+rMLJVhAqLCihFXqL43Osil9B v7ug== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-scsi-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-scsi-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=huawei.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id hq19si21496540ejc.88.2021.04.07.23.19.30 for ; Wed, 07 Apr 2021 23:19:30 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-scsi-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-scsi-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-scsi-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230420AbhDHGTi (ORCPT ); Thu, 8 Apr 2021 02:19:38 -0400 Received: from szxga05-in.huawei.com ([45.249.212.191]:16037 "EHLO szxga05-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231131AbhDHGT3 (ORCPT ); Thu, 8 Apr 2021 02:19:29 -0400 Received: from DGGEMS404-HUB.china.huawei.com (unknown [172.30.72.59]) by szxga05-in.huawei.com (SkyGuard) with ESMTP id 4FG9y66sp2zPp06; Thu, 8 Apr 2021 14:16:30 +0800 (CST) Received: from thunder-town.china.huawei.com (10.174.179.202) by DGGEMS404-HUB.china.huawei.com (10.3.19.204) with Microsoft SMTP Server id 14.3.498.0; Thu, 8 Apr 2021 14:19:08 +0800 From: Zhen Lei To: Sathya Prakash , Sreekanth Reddy , Suganath Prabu Subramani , "MPT-FusionLinux . pdl" , linux-scsi , linux-kernel CC: Zhen Lei Subject: [PATCH 2/3] scsi: mptfusion: Remove unused local variable 'port' Date: Thu, 8 Apr 2021 14:18:50 +0800 Message-ID: <20210408061851.3089-3-thunder.leizhen@huawei.com> X-Mailer: git-send-email 2.26.0.windows.1 In-Reply-To: <20210408061851.3089-1-thunder.leizhen@huawei.com> References: <20210408061851.3089-1-thunder.leizhen@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.174.179.202] X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org Fixes the following W=1 kernel build warning: drivers/message/fusion/mptctl.c: In function ‘mptctl_gettargetinfo drivers/message/fusion/mptctl.c:1372:7: warning: variable ‘port’ set but not used [-Wunused-but-set-variable] Reported-by: Hulk Robot Signed-off-by: Zhen Lei --- drivers/message/fusion/mptctl.c | 6 ------ 1 file changed, 6 deletions(-) -- 2.21.1 diff --git a/drivers/message/fusion/mptctl.c b/drivers/message/fusion/mptctl.c index 0a9321239e76..72025996cd70 100644 --- a/drivers/message/fusion/mptctl.c +++ b/drivers/message/fusion/mptctl.c @@ -1367,7 +1367,6 @@ mptctl_gettargetinfo (MPT_ADAPTER *ioc, unsigned long arg) int lun; int maxWordsLeft; int numBytes; - u8 port; struct scsi_device *sdev; if (copy_from_user(&karg, uarg, sizeof(struct mpt_ioctl_targetinfo))) { @@ -1379,13 +1378,8 @@ mptctl_gettargetinfo (MPT_ADAPTER *ioc, unsigned long arg) dctlprintk(ioc, printk(MYIOC_s_DEBUG_FMT "mptctl_gettargetinfo called.\n", ioc->name)); - /* Get the port number and set the maximum number of bytes - * in the returned structure. - * Ignore the port setting. - */ numBytes = karg.hdr.maxDataSize - sizeof(mpt_ioctl_header); maxWordsLeft = numBytes/sizeof(int); - port = karg.hdr.port; if (maxWordsLeft <= 0) { printk(MYIOC_s_ERR_FMT "%s@%d::mptctl_gettargetinfo() - no memory available!\n", From patchwork Thu Apr 8 06:18:51 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Leizhen \(ThunderTown\)" X-Patchwork-Id: 417401 Delivered-To: patch@linaro.org Received: by 2002:a02:8562:0:0:0:0:0 with SMTP id g89csp261237jai; Wed, 7 Apr 2021 23:19:28 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx3yAEQnJpw6RSbIenrAhjN+VK7Vo99Xq8qFcUzRHdc4vlkH8byeEzq/rRQaigpNnpls4D9 X-Received: by 2002:a17:906:5597:: with SMTP id y23mr8374421ejp.165.1617862768490; Wed, 07 Apr 2021 23:19:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1617862768; cv=none; d=google.com; s=arc-20160816; b=OF+rhh61qoDAt8HmL5NfSOx7oZYgnf+BdZ8uaFEOhIhfyl8zG2YaiyoxdcirQNMvtF xr78YnLOEzSEQLPmUJLW6k0wX/5mvy5Gg4tEYQIHYMldwe7GJwpX9nH41HB2IB+w+KNu uhKxwwmeuJEOG+QHuA9D2hhCMcRqomhOtWn0gn4p1atnwJqThVri/hyg7LJQRdTyGBHu nGLTFBoVElvqyD1oR1lkP60yVivWg/M6x98B5mhnzT1z3olyzInQzwY6deYoQ/MzlDLK mF2jEbEWJ7yMTxLEitlYJEyKtd1rMXmS2SkqI1AkHw/tqs+fTRDEhfs+85/TxpRNhjvM EZaw== 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 :references:in-reply-to:message-id:date:subject:cc:to:from; bh=pod6+4hJ6aVV4ABzs1MXDpb5TxAQGf0WOYUDlN4cQ3k=; b=MfGTjyBighDn/TdKrI+ehaIXrg6eHsxFn29hganpNYPToEsfUg5rbNAEdWCpI4Ceos X3mgmSto9+DYoDvjqbf1HhFoTUSV0QuBzaBAYLahEDkLU13no62N0xRV4u6aQ3uPazDx 3ts9wvwWfOtAh/Y8KZRkMdfN6FVPXEETO+JEGQLyG/bx18Mb4UtFKYRuzllUZFBpB06O u84e9/nuBUfoP9KluvljC0qOVSh9f4o1Iv3KN0ajzUiZV4gzaX/5AzyOqZmwqy29q3j+ 0o4AO4KYE0T9Bd2QOMKbLLYyReVfRUihe3vfI4ix6Wq2FPpiOtfk51Ia0NpkqzuoptPf r+Uw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-scsi-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-scsi-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=huawei.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id hq19si21496540ejc.88.2021.04.07.23.19.28 for ; Wed, 07 Apr 2021 23:19:28 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-scsi-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-scsi-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-scsi-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230308AbhDHGTg (ORCPT ); Thu, 8 Apr 2021 02:19:36 -0400 Received: from szxga05-in.huawei.com ([45.249.212.191]:15962 "EHLO szxga05-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231129AbhDHGT3 (ORCPT ); Thu, 8 Apr 2021 02:19:29 -0400 Received: from DGGEMS404-HUB.china.huawei.com (unknown [172.30.72.59]) by szxga05-in.huawei.com (SkyGuard) with ESMTP id 4FG9yp52Z9zyNZ9; Thu, 8 Apr 2021 14:17:06 +0800 (CST) Received: from thunder-town.china.huawei.com (10.174.179.202) by DGGEMS404-HUB.china.huawei.com (10.3.19.204) with Microsoft SMTP Server id 14.3.498.0; Thu, 8 Apr 2021 14:19:08 +0800 From: Zhen Lei To: Sathya Prakash , Sreekanth Reddy , Suganath Prabu Subramani , "MPT-FusionLinux . pdl" , linux-scsi , linux-kernel CC: Zhen Lei Subject: [PATCH 3/3] scsi: mptfusion: Fix error return code of mptctl_hp_hostinfo() Date: Thu, 8 Apr 2021 14:18:51 +0800 Message-ID: <20210408061851.3089-4-thunder.leizhen@huawei.com> X-Mailer: git-send-email 2.26.0.windows.1 In-Reply-To: <20210408061851.3089-1-thunder.leizhen@huawei.com> References: <20210408061851.3089-1-thunder.leizhen@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.174.179.202] X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org Ensure that all "goto out" error branches return correct error codes. Currently, always returns 0. Reported-by: Hulk Robot Signed-off-by: Zhen Lei --- drivers/message/fusion/mptctl.c | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) -- 2.21.1 diff --git a/drivers/message/fusion/mptctl.c b/drivers/message/fusion/mptctl.c index 72025996cd70..57bf511245b6 100644 --- a/drivers/message/fusion/mptctl.c +++ b/drivers/message/fusion/mptctl.c @@ -2326,7 +2326,7 @@ mptctl_hp_hostinfo(MPT_ADAPTER *ioc, unsigned long arg, unsigned int data_size) ToolboxIstwiReadWriteRequest_t *IstwiRWRequest; MPT_FRAME_HDR *mf = NULL; unsigned long timeleft; - int retval; + int retval = 0; u32 msgcontext; /* Reset long to int. Should affect IA64 and SPARC only @@ -2453,6 +2453,7 @@ mptctl_hp_hostinfo(MPT_ADAPTER *ioc, unsigned long arg, unsigned int data_size) if ((mf = mpt_get_msg_frame(mptctl_id, ioc)) == NULL) { dfailprintk(ioc, printk(MYIOC_s_WARN_FMT "%s, no msg frames!!\n", ioc->name, __func__)); + retval = -EFAULT; goto out; } @@ -2471,12 +2472,13 @@ mptctl_hp_hostinfo(MPT_ADAPTER *ioc, unsigned long arg, unsigned int data_size) IstwiRWRequest->DeviceAddr = 0xB0; pbuf = pci_alloc_consistent(ioc->pcidev, 4, &buf_dma); - if (!pbuf) + if (!pbuf) { + retval = -ENOMEM; goto out; + } ioc->add_sge((char *)&IstwiRWRequest->SGL, (MPT_SGE_FLAGS_SSIMPLE_READ|4), buf_dma); - retval = 0; SET_MGMT_MSG_CONTEXT(ioc->ioctl_cmds.msg_context, IstwiRWRequest->MsgContext); INITIALIZE_MGMT_STATUS(ioc->ioctl_cmds.status) @@ -2486,10 +2488,10 @@ mptctl_hp_hostinfo(MPT_ADAPTER *ioc, unsigned long arg, unsigned int data_size) timeleft = wait_for_completion_timeout(&ioc->ioctl_cmds.done, HZ*MPT_IOCTL_DEFAULT_TIMEOUT); if (!(ioc->ioctl_cmds.status & MPT_MGMT_STATUS_COMMAND_GOOD)) { - retval = -ETIME; printk(MYIOC_s_WARN_FMT "%s: failed\n", ioc->name, __func__); if (ioc->ioctl_cmds.status & MPT_MGMT_STATUS_DID_IOCRESET) { mpt_free_msg_frame(ioc, mf); + retval = -ETIME; goto out; } if (!timeleft) { @@ -2497,9 +2499,11 @@ mptctl_hp_hostinfo(MPT_ADAPTER *ioc, unsigned long arg, unsigned int data_size) "HOST INFO command timeout, doorbell=0x%08x\n", ioc->name, mpt_GetIocState(ioc, 0)); mptctl_timeout_expired(ioc, mf); - } else - goto retry_wait; - goto out; + retval = -ETIME; + goto out; + } + + goto retry_wait; } /* @@ -2530,7 +2534,7 @@ mptctl_hp_hostinfo(MPT_ADAPTER *ioc, unsigned long arg, unsigned int data_size) return -EFAULT; } - return 0; + return retval; }