Skip to contentSkip to conversation

scsi: ufs: ufs-exynos: Remove an unnecessary NULL check

PATCH Applied Dan Carpenter 3 participants 5 messages Jun 26, 2020 – Jun 30, 2020

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 scsi: ufs: ufs-exynos: Remove an unnecessary NULL check

The "head" pointer can't be NULL because it points to an address in the middle of a ufs_hba struct. Looking at this code, probably someone would wonder if the intent was to check whether "hba" is NULL, but "hba" isn't NULL and the check can just be removed.

---
 drivers/scsi/ufs/ufs-exynos.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/scsi/ufs/ufs-exynos.c +1 -1
index 16544b3dad47..802f7de626e8 100644
@@ -264,7 +264,7 @@ static int exynos_ufs_get_clk_info(struct exynos_ufs *ufs)
 	u8 div = 0;
 	int ret = 0;
 
-	if (!head || list_empty(head))
+	if (list_empty(head))
 		goto out;
 
 	list_for_each_entry(clki, head, list) {
Signature · 1 line
2.27.0
reviewer Acked-by on v1 1/1
#1 lore raw

Hi Dan

Quoted 2 lines

-----Original Message-----
The "head" pointer can't be NULL because it points to an address in the

middle

Quoted 1 line

of a ufs_hba struct. Looking at this code, probably someone would wonder

if

Quoted 5 lines

the intent was to check whether "hba" is NULL, but "hba" isn't NULL and the check can just be removed.

---

Please add Fixes: tag
With that

Thanks!

drivers/scsi/ufs/ufs-exynos.c

Quoted 4 lines
 drivers/scsi/ufs/ufs-exynos.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/scsi/ufs/ufs-exynos.c +0 -0

index

Quoted 15 lines

16544b3dad47..802f7de626e8 100644

drivers/scsi/ufs/ufs-exynos.c +1 -1
@@ -264,7 +264,7 @@ static int exynos_ufs_get_clk_info(struct exynos_ufs
 *ufs)
 	u8 div = 0;
 	int ret = 0;
 
-	if (!head || list_empty(head))
+	if (list_empty(head))
 		goto out;
 

list_for_each_entry(clki, head, list) {
--
2.27.0

#2 lore raw
Quoted 7 lines · Alim Akhtar

Hi Dan

Quoted 2 lines

-----Original Message-----
The "head" pointer can't be NULL because it points to an address in the

middle

Quoted 1 line

of a ufs_hba struct. Looking at this code, probably someone would wonder

if

Quoted 8 lines
Quoted 5 lines

the intent was to check whether "hba" is NULL, but "hba" isn't NULL and the check can just be removed.

---

Please add Fixes: tag
With that

It's not a bug fix it's just a cleanup.

regards,
dan carpenter

reviewer Acked-by
#3 lore raw

Hi Dan,

Quoted 7 lines

-----Original Message-----
From: Dan Carpenter <[email protected]>

Quoted 4 lines · Alim Akhtar

Hi Dan

Quoted 2 lines

-----Original Message-----
The "head" pointer can't be NULL because it points to an address in

the

Quoted 2 lines
Quoted 2 lines

middle

Quoted 1 line

of a ufs_hba struct. Looking at this code, probably someone would

wonder

Quoted 4 lines
Quoted 4 lines

if

Quoted 3 lines

the intent was to check whether "hba" is NULL, but "hba" isn't NULL and the check can just be removed.

Quoted 8 lines
Quoted 5 lines
Quoted 2 lines

---

Please add Fixes: tag
With that

It's not a bug fix it's just a cleanup.

Thanks!

Quoted 2 lines

regards,
dan carpenter

#4 lore raw
In reply to Dan Carpenter
Quoted 4 lines · Dan Carpenter

The "head" pointer can't be NULL because it points to an address in the middle of a ufs_hba struct. Looking at this code, probably someone would wonder if the intent was to check whether "hba" is NULL, but "hba" isn't NULL and the check can just be removed.

Applied to 5.9/scsi-queue, thanks!

[1/1] scsi: ufs: ufs-exynos: Remove an unnecessary NULL check

      https://git.kernel.org/mkp/scsi/c/b7a80dac0f1f
Signature · 1 line
Martin K. Petersen	Oracle Linux Engineering