aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBean Huo <[email protected]>2023-01-08 23:40:55 +0100
committerMartin K. Petersen <[email protected]>2023-01-11 22:16:59 -0500
commit5e87c51f186ef70b17201f97db11044e3e7ffa46 (patch)
tree91f8566cd3719ef370be349c2c85ca969133ad79
parent679062c65b2c7824b5bf6cef9d286ef101466122 (diff)
scsi: ufs: core: bsg: Fix sometimes-uninitialized warnings
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 <[email protected]> Reported-by: kernel test robot <[email protected]> Reported-by: Xiaosen He <[email protected]> Reviewed-by: Alim Akhtar <[email protected]> Reviewed-by: Nick Desaulniers <[email protected]> Reviewed-by: Bart Van Assche <[email protected]> Signed-off-by: Martin K. Petersen <[email protected]>
-rw-r--r--drivers/ufs/core/ufs_bsg.c4
1 files 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;