* [PATCH v2 0/3] Several compilation warnings fixes for UFS Advanced RPMB
@ 2023-01-08 22:40 Bean Huo
2023-01-08 22:40 ` [PATCH v2 1/3] scsi: ufs: core: bsg: Fix sometimes-uninitialized warnings Bean Huo
` (5 more replies)
0 siblings, 6 replies; 8+ messages in thread
From: Bean Huo @ 2023-01-08 22:40 UTC (permalink / raw)
To: alim.akhtar, avri.altman, jejb, martin.petersen, beanhuo,
bvanassche, quic_cang, quic_xiaosenh
Cc: linux-scsi, linux-kernel, Bean Huo
Hi Martin,
These patches are to fix several compilation warnings introduced by my commit:
6ff265fc5ef6 ("scsi: ufs: core: bsg: Add advanced RPMB support in ufs_bsg"),
please consider this patch series for the next your merge window.
Apologies for this!!
Changelog:
V1--V2:
1. Add new patches 2/3 and 3/3.
Bean Huo (3):
scsi: ufs: core: bsg: Fix sometimes-uninitialized warnings
scsi: core: Fix invisible definition compilation warning
scsi: ufs: core: bsg: Fix cast to restricted __be16 warning
drivers/ufs/core/ufs_bsg.c | 4 ++--
include/uapi/scsi/scsi_bsg_ufs.h | 12 ++++++------
include/ufs/ufshcd.h | 1 +
3 files changed, 9 insertions(+), 8 deletions(-)
--
2.25.1
^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH v2 1/3] scsi: ufs: core: bsg: Fix sometimes-uninitialized warnings
2023-01-08 22:40 [PATCH v2 0/3] Several compilation warnings fixes for UFS Advanced RPMB Bean Huo
@ 2023-01-08 22:40 ` Bean Huo
2023-01-11 17:22 ` Nick Desaulniers
2023-01-08 22:40 ` [PATCH v2 2/3] scsi: core: Fix invisible definition compilation warning Bean Huo
` (4 subsequent siblings)
5 siblings, 1 reply; 8+ messages in thread
From: Bean Huo @ 2023-01-08 22:40 UTC (permalink / raw)
To: alim.akhtar, avri.altman, jejb, martin.petersen, beanhuo,
bvanassche, quic_cang, quic_xiaosenh
Cc: linux-scsi, linux-kernel, kernel test robot
From: Bean Huo <beanhuo@micron.com>
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 <beanhuo@micron.com>
Reported-by: kernel test robot <lkp@intel.com>
Reported-by: Xiaosen He <quic_xiaosenh@quicinc.com>
Reviewed-by: Alim Akhtar <alim.akhtar@samsung.com>
---
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;
--
2.25.1
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH v2 2/3] scsi: core: Fix invisible definition compilation warning
2023-01-08 22:40 [PATCH v2 0/3] Several compilation warnings fixes for UFS Advanced RPMB Bean Huo
2023-01-08 22:40 ` [PATCH v2 1/3] scsi: ufs: core: bsg: Fix sometimes-uninitialized warnings Bean Huo
@ 2023-01-08 22:40 ` Bean Huo
2023-01-08 22:40 ` [PATCH v2 3/3] scsi: ufs: core: bsg: Fix cast to restricted __be16 warning Bean Huo
` (3 subsequent siblings)
5 siblings, 0 replies; 8+ messages in thread
From: Bean Huo @ 2023-01-08 22:40 UTC (permalink / raw)
To: alim.akhtar, avri.altman, jejb, martin.petersen, beanhuo,
bvanassche, quic_cang, quic_xiaosenh
Cc: linux-scsi, linux-kernel
From: Bean Huo <beanhuo@micron.com>
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 <quic_xiaosenh@quicinc.com>
Reported-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Bean Huo <beanhuo@micron.com>
---
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 <linux/blk-mq.h>
#include <linux/devfreq.h>
#include <linux/pm_runtime.h>
+#include <linux/dma-direction.h>
#include <scsi/scsi_device.h>
#include <ufs/unipro.h>
#include <ufs/ufs.h>
--
2.25.1
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH v2 3/3] scsi: ufs: core: bsg: Fix cast to restricted __be16 warning
2023-01-08 22:40 [PATCH v2 0/3] Several compilation warnings fixes for UFS Advanced RPMB Bean Huo
2023-01-08 22:40 ` [PATCH v2 1/3] scsi: ufs: core: bsg: Fix sometimes-uninitialized warnings Bean Huo
2023-01-08 22:40 ` [PATCH v2 2/3] scsi: core: Fix invisible definition compilation warning Bean Huo
@ 2023-01-08 22:40 ` Bean Huo
2023-01-08 23:40 ` [PATCH v2 0/3] Several compilation warnings fixes for UFS Advanced RPMB Bart Van Assche
` (2 subsequent siblings)
5 siblings, 0 replies; 8+ messages in thread
From: Bean Huo @ 2023-01-08 22:40 UTC (permalink / raw)
To: alim.akhtar, avri.altman, jejb, martin.petersen, beanhuo,
bvanassche, quic_cang, quic_xiaosenh
Cc: linux-scsi, linux-kernel, kernel test robot
From: Bean Huo <beanhuo@micron.com>
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 <lkp@intel.com>
Signed-off-by: Bean Huo <beanhuo@micron.com>
---
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__));
--
2.25.1
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH v2 0/3] Several compilation warnings fixes for UFS Advanced RPMB
2023-01-08 22:40 [PATCH v2 0/3] Several compilation warnings fixes for UFS Advanced RPMB Bean Huo
` (2 preceding siblings ...)
2023-01-08 22:40 ` [PATCH v2 3/3] scsi: ufs: core: bsg: Fix cast to restricted __be16 warning Bean Huo
@ 2023-01-08 23:40 ` Bart Van Assche
2023-01-12 4:37 ` Martin K. Petersen
2023-01-14 3:06 ` Martin K. Petersen
5 siblings, 0 replies; 8+ messages in thread
From: Bart Van Assche @ 2023-01-08 23:40 UTC (permalink / raw)
To: Bean Huo, alim.akhtar, avri.altman, jejb, martin.petersen,
beanhuo, quic_cang, quic_xiaosenh
Cc: linux-scsi, linux-kernel
On 1/8/23 14:40, Bean Huo wrote:
> These patches are to fix several compilation warnings introduced by my commit:
> 6ff265fc5ef6 ("scsi: ufs: core: bsg: Add advanced RPMB support in ufs_bsg"),
> please consider this patch series for the next your merge window.
For the entire series:
Reviewed-by: Bart Van Assche <bvanassche@acm.org>
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH v2 1/3] scsi: ufs: core: bsg: Fix sometimes-uninitialized warnings
2023-01-08 22:40 ` [PATCH v2 1/3] scsi: ufs: core: bsg: Fix sometimes-uninitialized warnings Bean Huo
@ 2023-01-11 17:22 ` Nick Desaulniers
0 siblings, 0 replies; 8+ messages in thread
From: Nick Desaulniers @ 2023-01-11 17:22 UTC (permalink / raw)
To: Bean Huo
Cc: alim.akhtar, avri.altman, jejb, martin.petersen, beanhuo,
bvanassche, quic_cang, quic_xiaosenh, linux-scsi, linux-kernel,
kernel test robot, llvm
On Sun, Jan 08, 2023 at 11:40:55PM +0100, Bean Huo wrote:
> From: Bean Huo <beanhuo@micron.com>
>
> 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 <beanhuo@micron.com>
> Reported-by: kernel test robot <lkp@intel.com>
> Reported-by: Xiaosen He <quic_xiaosenh@quicinc.com>
> Reviewed-by: Alim Akhtar <alim.akhtar@samsung.com>
Thanks for the patch!
Reviewed-by: Nick Desaulniers <ndesaulniers@google.com>
We also got a report from KernelCI:
Link: https://lore.kernel.org/llvm/63be5f73.170a0220.16f9f.8b91@mx.google.com/
Reported-by: kernelci.org bot <bot@kernelci.org>
> ---
> 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;
>
> --
> 2.25.1
>
>
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH v2 0/3] Several compilation warnings fixes for UFS Advanced RPMB
2023-01-08 22:40 [PATCH v2 0/3] Several compilation warnings fixes for UFS Advanced RPMB Bean Huo
` (3 preceding siblings ...)
2023-01-08 23:40 ` [PATCH v2 0/3] Several compilation warnings fixes for UFS Advanced RPMB Bart Van Assche
@ 2023-01-12 4:37 ` Martin K. Petersen
2023-01-14 3:06 ` Martin K. Petersen
5 siblings, 0 replies; 8+ messages in thread
From: Martin K. Petersen @ 2023-01-12 4:37 UTC (permalink / raw)
To: Bean Huo
Cc: alim.akhtar, avri.altman, jejb, martin.petersen, beanhuo,
bvanassche, quic_cang, quic_xiaosenh, linux-scsi, linux-kernel
Bean,
> These patches are to fix several compilation warnings introduced by my
> commit: 6ff265fc5ef6 ("scsi: ufs: core: bsg: Add advanced RPMB support
> in ufs_bsg"), please consider this patch series for the next your
> merge window. Apologies for this!!
Applied to 6.3/scsi-staging, thanks!
--
Martin K. Petersen Oracle Linux Engineering
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH v2 0/3] Several compilation warnings fixes for UFS Advanced RPMB
2023-01-08 22:40 [PATCH v2 0/3] Several compilation warnings fixes for UFS Advanced RPMB Bean Huo
` (4 preceding siblings ...)
2023-01-12 4:37 ` Martin K. Petersen
@ 2023-01-14 3:06 ` Martin K. Petersen
5 siblings, 0 replies; 8+ messages in thread
From: Martin K. Petersen @ 2023-01-14 3:06 UTC (permalink / raw)
To: alim.akhtar, avri.altman, jejb, beanhuo, bvanassche, quic_cang,
quic_xiaosenh, Bean Huo
Cc: Martin K . Petersen, linux-scsi, linux-kernel
On Sun, 08 Jan 2023 23:40:54 +0100, Bean Huo wrote:
> These patches are to fix several compilation warnings introduced by my commit:
> 6ff265fc5ef6 ("scsi: ufs: core: bsg: Add advanced RPMB support in ufs_bsg"),
> please consider this patch series for the next your merge window.
> Apologies for this!!
>
>
>
> [...]
Applied to 6.3/scsi-queue, thanks!
[1/3] scsi: ufs: core: bsg: Fix sometimes-uninitialized warnings
https://git.kernel.org/mkp/scsi/c/5e87c51f186e
[2/3] scsi: core: Fix invisible definition compilation warning
https://git.kernel.org/mkp/scsi/c/f3e57da52812
[3/3] scsi: ufs: core: bsg: Fix cast to restricted __be16 warning
https://git.kernel.org/mkp/scsi/c/e2cb6e8db69e
--
Martin K. Petersen Oracle Linux Engineering
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2023-01-14 3:07 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-01-08 22:40 [PATCH v2 0/3] Several compilation warnings fixes for UFS Advanced RPMB Bean Huo
2023-01-08 22:40 ` [PATCH v2 1/3] scsi: ufs: core: bsg: Fix sometimes-uninitialized warnings Bean Huo
2023-01-11 17:22 ` Nick Desaulniers
2023-01-08 22:40 ` [PATCH v2 2/3] scsi: core: Fix invisible definition compilation warning Bean Huo
2023-01-08 22:40 ` [PATCH v2 3/3] scsi: ufs: core: bsg: Fix cast to restricted __be16 warning Bean Huo
2023-01-08 23:40 ` [PATCH v2 0/3] Several compilation warnings fixes for UFS Advanced RPMB Bart Van Assche
2023-01-12 4:37 ` Martin K. Petersen
2023-01-14 3:06 ` Martin K. Petersen
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox