Commit 5e87c51f authored by Bean Huo's avatar Bean Huo Committed by Martin K. Petersen

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: 6ff265fc ("scsi: ufs: core: bsg: Add advanced RPMB support in ufs_bsg")
Signed-off-by: default avatarBean Huo <beanhuo@micron.com>
Reported-by: default avatarkernel test robot <lkp@intel.com>
Reported-by: default avatarXiaosen He <quic_xiaosenh@quicinc.com>
Reviewed-by: default avatarAlim Akhtar <alim.akhtar@samsung.com>
Reviewed-by: default avatarNick Desaulniers <ndesaulniers@google.com>
Reviewed-by: default avatarBart Van Assche <bvanassche@acm.org>
Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
parent 679062c6
...@@ -70,9 +70,9 @@ static int ufs_bsg_exec_advanced_rpmb_req(struct ufs_hba *hba, struct bsg_job *j ...@@ -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 ufs_rpmb_reply *rpmb_reply = job->reply;
struct bsg_buffer *payload = NULL; struct bsg_buffer *payload = NULL;
enum dma_data_direction dir; enum dma_data_direction dir;
struct scatterlist *sg_list; struct scatterlist *sg_list = NULL;
int rpmb_req_type; int rpmb_req_type;
int sg_cnt; int sg_cnt = 0;
int ret; int ret;
int data_len; int data_len;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment