diff mbox series

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

Message ID 20200626105133.GF314359@mwanda (mailing list archive)
State Not Applicable
Headers show
Series scsi: ufs: ufs-exynos: Remove an unnecessary NULL check | expand

Commit Message

Dan Carpenter June 26, 2020, 10:51 a.m. UTC
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.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
 drivers/scsi/ufs/ufs-exynos.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Alim Akhtar June 27, 2020, 5:21 p.m. UTC | #1
Hi Dan

> -----Original Message-----
> 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.
> 
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> ---
Please add Fixes: tag
With that
Acked-by: Alim Akhtar <alim.akhtar@samsung.com>

Thanks!

>  drivers/scsi/ufs/ufs-exynos.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/scsi/ufs/ufs-exynos.c b/drivers/scsi/ufs/ufs-exynos.c
index
> 16544b3dad47..802f7de626e8 100644
> --- a/drivers/scsi/ufs/ufs-exynos.c
> +++ b/drivers/scsi/ufs/ufs-exynos.c
> @@ -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
Dan Carpenter June 27, 2020, 5:54 p.m. UTC | #2
On Sat, Jun 27, 2020 at 10:51:44PM +0530, Alim Akhtar wrote:
> Hi Dan
> 
> > -----Original Message-----
> > 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.
> > 
> > Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> > ---
> Please add Fixes: tag
> With that
> Acked-by: Alim Akhtar <alim.akhtar@samsung.com>

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

regards,
dan carpenter
Alim Akhtar June 28, 2020, 1:56 a.m. UTC | #3
Hi Dan,

> -----Original Message-----
> From: Dan Carpenter <dan.carpenter@oracle.com>
> On Sat, Jun 27, 2020 at 10:51:44PM +0530, Alim Akhtar wrote:
> > Hi Dan
> >
> > > -----Original Message-----
> > > 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.
> > >
> > > Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> > > ---
> > Please add Fixes: tag
> > With that
> > Acked-by: Alim Akhtar <alim.akhtar@samsung.com>
> 
> It's not a bug fix it's just a cleanup.
> 
Acked-by: Alim Akhtar <alim.akhtar@samsung.com>

Thanks!

> regards,
> dan carpenter
Martin K. Petersen June 30, 2020, 3:23 a.m. UTC | #4
On Fri, 26 Jun 2020 13:51:33 +0300, Dan Carpenter wrote:

> 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
diff mbox series

Patch

diff --git a/drivers/scsi/ufs/ufs-exynos.c b/drivers/scsi/ufs/ufs-exynos.c
index 16544b3dad47..802f7de626e8 100644
--- a/drivers/scsi/ufs/ufs-exynos.c
+++ b/drivers/scsi/ufs/ufs-exynos.c
@@ -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) {