From patchwork Sun Jan 8 22:40:55 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bean Huo X-Patchwork-Id: 13092749 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 A96F1C67871 for ; Sun, 8 Jan 2023 22:41:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231378AbjAHWl3 (ORCPT ); Sun, 8 Jan 2023 17:41:29 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60588 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233774AbjAHWlW (ORCPT ); Sun, 8 Jan 2023 17:41:22 -0500 Received: from mo4-p02-ob.smtp.rzone.de (mo4-p02-ob.smtp.rzone.de [85.215.255.83]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 341DFF584; Sun, 8 Jan 2023 14:41:19 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; t=1673217670; s=strato-dkim-0002; d=iokpp.de; h=References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Cc:Date: From:Subject:Sender; bh=PbYONqe9jh9eXb5CBIRUMjVZLfLvI+aokxWTZGr6DLs=; b=UpONrLUnz6UQk+vYZDTzw6eH7OigL8+WTM4hJDKJyAMDH7eU0NGeJi3h1MKXfGLX/w dCerFM1GImw+ZdodJw80sIQdqe4hDM6eXEm3um0b8n2E1q001wefXozTPHbQ7hYvAGD8 asiLhK+qOxUrrS7CxcUvpgxQ7BPSFXSG1hHS3BLRkNjoh0WKgtMoC4yHo5K6kDqjXQh3 Rt05AFYkAzPQwz0+ScciqivQqGakriFTy6btrIIH6twNVSa18TUw3yyBs2jkuGLBiZIV mEV3X0FZLQFrI4zJc9f5aW9IpLCwVxwPXo5VHafOEtv7AVJreMFoMxHn2Ki06ObPeQ1+ dWyQ== Authentication-Results: strato.com; dkim=none X-RZG-AUTH: ":LmkFe0i9dN8c2t4QQyGBB/NDXvjDB6pBSedrgBzPc9DUyubU4DD1QLj68UeUr1+U1UnWvo/SqbTSXcQZxAZvLxWc5msS6txu0oUh" X-RZG-CLASS-ID: mo01 Received: from blinux.speedport.ip by smtp.strato.de (RZmta 48.2.1 AUTH) with ESMTPSA id 905423z08MfAAe9 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256 bits)) (Client did not present a certificate); Sun, 8 Jan 2023 23:41:10 +0100 (CET) From: Bean Huo To: alim.akhtar@samsung.com, avri.altman@wdc.com, jejb@linux.ibm.com, martin.petersen@oracle.com, beanhuo@micron.com, bvanassche@acm.org, quic_cang@quicinc.com, quic_xiaosenh@quicinc.com Cc: linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org, kernel test robot Subject: [PATCH v2 1/3] scsi: ufs: core: bsg: Fix sometimes-uninitialized warnings Date: Sun, 8 Jan 2023 23:40:55 +0100 Message-Id: <20230108224057.354438-2-beanhuo@iokpp.de> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230108224057.354438-1-beanhuo@iokpp.de> References: <20230108224057.354438-1-beanhuo@iokpp.de> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org From: Bean Huo Compilation complains that two possible variables are used without initialization: drivers/ufs/core/ufs_bsg.c:112:6: warning: variable 'sg_cnt' is used uninitialized whenever 'if' condition is false [-Wsometimes-uninitialized] drivers/ufs/core/ufs_bsg.c:112:6: warning: variable 'sg_list' is used uninitialized whenever 'if' condition is false [-Wsometimes-uninitialized] Fix both warnings by adding initialization with sg_cnt = 0, sg_list = NULL. Fixes: 6ff265fc5ef6 ("scsi: ufs: core: bsg: Add advanced RPMB support in ufs_bsg") Signed-off-by: Bean Huo Reported-by: kernel test robot Reported-by: Xiaosen He Reviewed-by: Alim Akhtar Reviewed-by: Nick Desaulniers Reported-by: kernelci.org bot --- drivers/ufs/core/ufs_bsg.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/ufs/core/ufs_bsg.c b/drivers/ufs/core/ufs_bsg.c index 0044029bcf7b..0d38e7fa34cc 100644 --- a/drivers/ufs/core/ufs_bsg.c +++ b/drivers/ufs/core/ufs_bsg.c @@ -70,9 +70,9 @@ static int ufs_bsg_exec_advanced_rpmb_req(struct ufs_hba *hba, struct bsg_job *j struct ufs_rpmb_reply *rpmb_reply = job->reply; struct bsg_buffer *payload = NULL; enum dma_data_direction dir; - struct scatterlist *sg_list; + struct scatterlist *sg_list = NULL; int rpmb_req_type; - int sg_cnt; + int sg_cnt = 0; int ret; int data_len; From patchwork Sun Jan 8 22:40:56 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Bean Huo X-Patchwork-Id: 13092750 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 D7121C54EBD for ; Sun, 8 Jan 2023 22:44:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231378AbjAHWoy (ORCPT ); Sun, 8 Jan 2023 17:44:54 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34250 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229937AbjAHWot (ORCPT ); Sun, 8 Jan 2023 17:44:49 -0500 Received: from mo4-p02-ob.smtp.rzone.de (mo4-p02-ob.smtp.rzone.de [85.215.255.83]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DA577F036; Sun, 8 Jan 2023 14:44:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; t=1673217671; s=strato-dkim-0002; d=iokpp.de; h=References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Cc:Date: From:Subject:Sender; bh=gaLa1rSJhxlmjdIWXyAhwDAq4r+726KZF2WV60kFgUw=; b=fZY2SLl7U6f8IAx1H6o6cM6awDRvZZOvSh9gE8wDoNzM5D8zGYwervlmL8XKgiDxXI UkBcsVrmVvmLBOD303uyd537xPTnXWXVlG4K6DfeLiqvZ10nNiJZrYM5epRt2Y+1JObe swK5COZHXDKT7tWzgxXtTOMheoWHrqUygpDvSz0T0QEvY28/lOK3hA1Gn73+RP18C7f3 +W3DSCMHo6dMaTlDVhF0WBQR7qW/6CG8bQ3cW2CFn6mLaicM1JVLvsjUtGpjtrsMrOwK bEmseA/N20T54Kb/MHsU7J6anrdLZUeRAjX1sAv6f4WkHgZ9cabYqs5cRenk0O2ogHvD S5ng== Authentication-Results: strato.com; dkim=none X-RZG-AUTH: ":LmkFe0i9dN8c2t4QQyGBB/NDXvjDB6pBSedrgBzPc9DUyubU4DD1QLj68UeUr1+U1UnWvo/SqbTSXcQZxAZvLxWc5msS6txu0oUh" X-RZG-CLASS-ID: mo02 Received: from blinux.speedport.ip by smtp.strato.de (RZmta 48.2.1 AUTH) with ESMTPSA id 905423z08MfAAeA (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256 bits)) (Client did not present a certificate); Sun, 8 Jan 2023 23:41:10 +0100 (CET) From: Bean Huo To: alim.akhtar@samsung.com, avri.altman@wdc.com, jejb@linux.ibm.com, martin.petersen@oracle.com, beanhuo@micron.com, bvanassche@acm.org, quic_cang@quicinc.com, quic_xiaosenh@quicinc.com Cc: linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 2/3] scsi: core: Fix invisible definition compilation warning Date: Sun, 8 Jan 2023 23:40:56 +0100 Message-Id: <20230108224057.354438-3-beanhuo@iokpp.de> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230108224057.354438-1-beanhuo@iokpp.de> References: <20230108224057.354438-1-beanhuo@iokpp.de> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org From: Bean Huo In 'include/ufs/ufshcd.h' file, 'enum dma_data_direction' will be used, which is defined in linux/dma-direction.h, however, this header file is not included in ufshcd.h, thus causing the following compilation warning: "warning: ‘enum dma_data_direction’ declared inside parameter list will not be visible outside of this definition or declaration" Fix this warning by including 'linux/dma-direction.h'. Fixes: 6ff265fc5ef6 ("scsi: ufs: core: bsg: Add advanced RPMB support in ufs_bsg") Reported-by: Xiaosen He Reported-by: Bart Van Assche Signed-off-by: Bean Huo --- include/ufs/ufshcd.h | 1 + 1 file changed, 1 insertion(+) diff --git a/include/ufs/ufshcd.h b/include/ufs/ufshcd.h index dd5912b4db77..e44a41abcc05 100644 --- a/include/ufs/ufshcd.h +++ b/include/ufs/ufshcd.h @@ -17,6 +17,7 @@ #include #include #include +#include #include #include #include From patchwork Sun Jan 8 22:40:57 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bean Huo X-Patchwork-Id: 13092748 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 0D16FC61DB3 for ; Sun, 8 Jan 2023 22:41:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233986AbjAHWlZ (ORCPT ); Sun, 8 Jan 2023 17:41:25 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60566 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233703AbjAHWlU (ORCPT ); Sun, 8 Jan 2023 17:41:20 -0500 Received: from mo4-p02-ob.smtp.rzone.de (mo4-p02-ob.smtp.rzone.de [85.215.255.84]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D2944F01F; Sun, 8 Jan 2023 14:41:19 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; t=1673217671; s=strato-dkim-0002; d=iokpp.de; h=References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Cc:Date: From:Subject:Sender; bh=XJkNB7M2uzWaXUezNZhIWw8zxGs2iBO99QLhdOOLpXA=; b=l7DNhPITdyIFswQNIbsWHMpvoFfkJMX8EHCJT5HkuHxFh1LaPGb0NnpYb9l2RczOHW tc1yHVHduJbEBDrBCCtqJEO9d8X2SSQipPa5uae8fMsSQVLQhWIs6KvwUj2m56u4tg0s G9TjVLLA1mWlA4qwpPLqiZ1RtQqtbyZAnCpfmn9tdaNHedHx6xaeGtctmv9jUd9IeLyd DdzXJkq8DiV+40t1RQ+cRb7a6jWqNu982cRC0VoxiWna4rIpcuesqvuzn3oyNVViPdBB W+Xs/CjR7fXEdC+VkzXd4eB8OGBNuIYD2FO0tLQ6XkHNlbvcqYksDni7EPRV5y30jdb8 Fo3A== Authentication-Results: strato.com; dkim=none X-RZG-AUTH: ":LmkFe0i9dN8c2t4QQyGBB/NDXvjDB6pBSedrgBzPc9DUyubU4DD1QLj68UeUr1+U1UnWvo/SqbTSXcQZxAZvLxWc5msS6txu0oUh" X-RZG-CLASS-ID: mo02 Received: from blinux.speedport.ip by smtp.strato.de (RZmta 48.2.1 AUTH) with ESMTPSA id 905423z08MfBAeB (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256 bits)) (Client did not present a certificate); Sun, 8 Jan 2023 23:41:11 +0100 (CET) From: Bean Huo To: alim.akhtar@samsung.com, avri.altman@wdc.com, jejb@linux.ibm.com, martin.petersen@oracle.com, beanhuo@micron.com, bvanassche@acm.org, quic_cang@quicinc.com, quic_xiaosenh@quicinc.com Cc: linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org, kernel test robot Subject: [PATCH v2 3/3] scsi: ufs: core: bsg: Fix cast to restricted __be16 warning Date: Sun, 8 Jan 2023 23:40:57 +0100 Message-Id: <20230108224057.354438-4-beanhuo@iokpp.de> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230108224057.354438-1-beanhuo@iokpp.de> References: <20230108224057.354438-1-beanhuo@iokpp.de> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org From: Bean Huo Fix the following sparse endianness warning: "sparse warnings: drivers/ufs/core/ufs_bsg.c:91:25: sparse: sparse: cast to restricted __be16." For consistency with endianness annotations of other UFS data structures, change __u16/32 to __be16/32 in UFS ARPMB data structures. Fixes: 6ff265fc5ef6 ("scsi: ufs: core: bsg: Add advanced RPMB support in ufs_bsg") Reported-by: kernel test robot Signed-off-by: Bean Huo --- include/uapi/scsi/scsi_bsg_ufs.h | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/include/uapi/scsi/scsi_bsg_ufs.h b/include/uapi/scsi/scsi_bsg_ufs.h index 276e2772328f..2801b65299aa 100644 --- a/include/uapi/scsi/scsi_bsg_ufs.h +++ b/include/uapi/scsi/scsi_bsg_ufs.h @@ -97,18 +97,18 @@ struct utp_upiu_req { }; struct ufs_arpmb_meta { - __u16 req_resp_type; + __be16 req_resp_type; __u8 nonce[16]; - __u32 write_counter; - __u16 addr_lun; - __u16 block_count; - __u16 result; + __be32 write_counter; + __be16 addr_lun; + __be16 block_count; + __be16 result; } __attribute__((__packed__)); struct ufs_ehs { __u8 length; __u8 ehs_type; - __u16 ehssub_type; + __be16 ehssub_type; struct ufs_arpmb_meta meta; __u8 mac_key[32]; } __attribute__((__packed__));