public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH ] scsi: ufs: core: bsg: Fix sometimes-uninitialized warnings
@ 2022-12-31 15:03 ` Bean Huo
  2023-01-02  4:58   ` Alim Akhtar
  0 siblings, 1 reply; 2+ messages in thread
From: Bean Huo @ 2022-12-31 15:03 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>
---
Hi Martin,

This patch is to fix two compilation warnings introduced by my commit:
6ff265fc5ef6 ("scsi: ufs: core: bsg: Add advanced RPMB support in ufs_bsg").

Apologies for this.

---
 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] 2+ messages in thread

* RE: [PATCH ] scsi: ufs: core: bsg: Fix sometimes-uninitialized warnings
  2022-12-31 15:03 ` [PATCH ] scsi: ufs: core: bsg: Fix sometimes-uninitialized warnings Bean Huo
@ 2023-01-02  4:58   ` Alim Akhtar
  0 siblings, 0 replies; 2+ messages in thread
From: Alim Akhtar @ 2023-01-02  4:58 UTC (permalink / raw)
  To: 'Bean Huo', avri.altman, jejb, martin.petersen, beanhuo,
	bvanassche, quic_cang, quic_xiaosenh
  Cc: linux-scsi, linux-kernel, 'kernel test robot'

Hi Bean,

>-----Original Message-----
>From: Bean Huo [mailto:beanhuo@iokpp.de]
>Sent: Saturday, December 31, 2022 8:34 PM
>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 <lkp@intel.com>
>Subject: [PATCH ] scsi: ufs: core: bsg: Fix sometimes-uninitialized
warnings
>
>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>

>Hi Martin,
>
>This patch is to fix two compilation warnings introduced by my commit:
>6ff265fc5ef6 ("scsi: ufs: core: bsg: Add advanced RPMB support in
ufs_bsg").
>
>Apologies for this.
>
>---
> 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] 2+ messages in thread

end of thread, other threads:[~2023-01-02  4:59 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <CGME20221231150441epcas5p376dfc9832b2a0e1dc6ea9f98b80a2ecb@epcas5p3.samsung.com>
2022-12-31 15:03 ` [PATCH ] scsi: ufs: core: bsg: Fix sometimes-uninitialized warnings Bean Huo
2023-01-02  4:58   ` Alim Akhtar

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox