RE: [PATCH] scsi: ufs: clean up ufshpb_check_hpb_reset_query()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> Smatch complains that the if (flag_res) is not required:
> 
>     drivers/ufs/core/ufshpb.c:2306 ufshpb_check_hpb_reset_query()
>     warn: duplicate check 'flag_res' (previous on line 2301)
> 
> Re-write the "if (flag_res)" checking to be more clear.
> 
> Signed-off-by: Dan Carpenter <dan.carpenter@xxxxxxxxxx>
In HPB Reset, the Host set this flag as '1' to inform the device that host reset its L2P data.
The Device resets flag as '0' when the device inactivated all region information.
0h: HPB reset completed or not started yet.
1h: HPB reset in progress.

Would make sense to me to contain this logic within this function,
Instead of returning just the flag value.

Thanks,
Avri
> ---
>  drivers/ufs/core/ufshpb.c | 14 ++++++--------
>  1 file changed, 6 insertions(+), 8 deletions(-)
> 
> diff --git a/drivers/ufs/core/ufshpb.c b/drivers/ufs/core/ufshpb.c
> index fb122eaed28b..95b501b824df 100644
> --- a/drivers/ufs/core/ufshpb.c
> +++ b/drivers/ufs/core/ufshpb.c
> @@ -2299,17 +2299,15 @@ static bool ufshpb_check_hpb_reset_query(struct
> ufs_hba *hba)
>                 }
> 
>                 if (!flag_res)
> -                       goto out;
> +                       return false;
> 
>                 usleep_range(1000, 1100);
>         }
> -       if (flag_res) {
> -               dev_err(hba->dev,
> -                       "%s fHpbReset was not cleared by the device\n",
> -                       __func__);
> -       }
> -out:
> -       return flag_res;
> +
> +       dev_err(hba->dev,
> +               "%s fHpbReset was not cleared by the device\n",
> +               __func__);
> +       return true;
>  }
> 
>  /**
> --
> 2.35.1





[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [SCSI Target Devel]     [Linux SCSI Target Infrastructure]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Linux IIO]     [Samba]     [Device Mapper]

  Powered by Linux