linux-samsung-soc.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH -next] scsi: ufs: ufs-exynos: Fix return value check in exynos_ufs_init()
@ 2020-06-18 13:38 ` Wei Yongjun
  2020-06-21  1:38   ` Alim Akhtar
  2020-06-24  4:30   ` Martin K. Petersen
  0 siblings, 2 replies; 3+ messages in thread
From: Wei Yongjun @ 2020-06-18 13:38 UTC (permalink / raw)
  To: Alim Akhtar, Avri Altman, James E.J. Bottomley,
	Martin K. Petersen, Kukjin Kim, Krzysztof Kozlowski, Kiwoong Kim,
	Seungwon Jeon
  Cc: Wei Yongjun, linux-scsi, linux-arm-kernel, linux-samsung-soc,
	kernel-janitors, Hulk Robot

In case of error, the function devm_ioremap_resource() returns ERR_PTR()
and never returns NULL. The NULL test in the return value check should
be replaced with IS_ERR().

Fixes: 55f4b1f73631 ("scsi: ufs: ufs-exynos: Add UFS host support for Exynos SoCs")
Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
---
 drivers/scsi/ufs/ufs-exynos.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/scsi/ufs/ufs-exynos.c b/drivers/scsi/ufs/ufs-exynos.c
index 440f2af83d9c..c918fbc6ca60 100644
--- a/drivers/scsi/ufs/ufs-exynos.c
+++ b/drivers/scsi/ufs/ufs-exynos.c
@@ -950,25 +950,25 @@ static int exynos_ufs_init(struct ufs_hba *hba)
 	/* exynos-specific hci */
 	res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "vs_hci");
 	ufs->reg_hci = devm_ioremap_resource(dev, res);
-	if (!ufs->reg_hci) {
+	if (IS_ERR(ufs->reg_hci)) {
 		dev_err(dev, "cannot ioremap for hci vendor register\n");
-		return -ENOMEM;
+		return PTR_ERR(ufs->reg_hci);
 	}
 
 	/* unipro */
 	res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "unipro");
 	ufs->reg_unipro = devm_ioremap_resource(dev, res);
-	if (!ufs->reg_unipro) {
+	if (IS_ERR(ufs->reg_unipro)) {
 		dev_err(dev, "cannot ioremap for unipro register\n");
-		return -ENOMEM;
+		return PTR_ERR(ufs->reg_unipro);
 	}
 
 	/* ufs protector */
 	res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "ufsp");
 	ufs->reg_ufsp = devm_ioremap_resource(dev, res);
-	if (!ufs->reg_ufsp) {
+	if (IS_ERR(ufs->reg_ufsp)) {
 		dev_err(dev, "cannot ioremap for ufs protector register\n");
-		return -ENOMEM;
+		return PTR_ERR(ufs->reg_ufsp);
 	}
 
 	ret = exynos_ufs_parse_dt(dev, ufs);




^ permalink raw reply related	[flat|nested] 3+ messages in thread

* RE: [PATCH -next] scsi: ufs: ufs-exynos: Fix return value check in exynos_ufs_init()
  2020-06-18 13:38 ` [PATCH -next] scsi: ufs: ufs-exynos: Fix return value check in exynos_ufs_init() Wei Yongjun
@ 2020-06-21  1:38   ` Alim Akhtar
  2020-06-24  4:30   ` Martin K. Petersen
  1 sibling, 0 replies; 3+ messages in thread
From: Alim Akhtar @ 2020-06-21  1:38 UTC (permalink / raw)
  To: 'Wei Yongjun', 'Avri Altman',
	'James E.J. Bottomley', 'Martin K. Petersen',
	'Kukjin Kim', 'Krzysztof Kozlowski',
	'Kiwoong Kim', 'Seungwon Jeon'
  Cc: linux-scsi, linux-arm-kernel, linux-samsung-soc, kernel-janitors,
	'Hulk Robot'

Hi Wei,

> In case of error, the function devm_ioremap_resource() returns ERR_PTR()
and
> never returns NULL. The NULL test in the return value check should be
replaced
> with IS_ERR().
> 
> Fixes: 55f4b1f73631 ("scsi: ufs: ufs-exynos: Add UFS host support for
Exynos
> SoCs")
> Reported-by: Hulk Robot <hulkci@huawei.com>
> Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
> ---
Acked-by: Alim Akhtar <alim.akhtar@samsung.com>

Thanks!

>  drivers/scsi/ufs/ufs-exynos.c | 12 ++++++------
>  1 file changed, 6 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/scsi/ufs/ufs-exynos.c b/drivers/scsi/ufs/ufs-exynos.c
index
> 440f2af83d9c..c918fbc6ca60 100644
> --- a/drivers/scsi/ufs/ufs-exynos.c
> +++ b/drivers/scsi/ufs/ufs-exynos.c
> @@ -950,25 +950,25 @@ static int exynos_ufs_init(struct ufs_hba *hba)
>  	/* exynos-specific hci */
>  	res = platform_get_resource_byname(pdev, IORESOURCE_MEM,
> "vs_hci");
>  	ufs->reg_hci = devm_ioremap_resource(dev, res);
> -	if (!ufs->reg_hci) {
> +	if (IS_ERR(ufs->reg_hci)) {
>  		dev_err(dev, "cannot ioremap for hci vendor register\n");
> -		return -ENOMEM;
> +		return PTR_ERR(ufs->reg_hci);
>  	}
> 
>  	/* unipro */
>  	res = platform_get_resource_byname(pdev, IORESOURCE_MEM,
> "unipro");
>  	ufs->reg_unipro = devm_ioremap_resource(dev, res);
> -	if (!ufs->reg_unipro) {
> +	if (IS_ERR(ufs->reg_unipro)) {
>  		dev_err(dev, "cannot ioremap for unipro register\n");
> -		return -ENOMEM;
> +		return PTR_ERR(ufs->reg_unipro);
>  	}
> 
>  	/* ufs protector */
>  	res = platform_get_resource_byname(pdev, IORESOURCE_MEM,
> "ufsp");
>  	ufs->reg_ufsp = devm_ioremap_resource(dev, res);
> -	if (!ufs->reg_ufsp) {
> +	if (IS_ERR(ufs->reg_ufsp)) {
>  		dev_err(dev, "cannot ioremap for ufs protector register\n");
> -		return -ENOMEM;
> +		return PTR_ERR(ufs->reg_ufsp);
>  	}
> 
>  	ret = exynos_ufs_parse_dt(dev, ufs);
> 
> 



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH -next] scsi: ufs: ufs-exynos: Fix return value check in exynos_ufs_init()
  2020-06-18 13:38 ` [PATCH -next] scsi: ufs: ufs-exynos: Fix return value check in exynos_ufs_init() Wei Yongjun
  2020-06-21  1:38   ` Alim Akhtar
@ 2020-06-24  4:30   ` Martin K. Petersen
  1 sibling, 0 replies; 3+ messages in thread
From: Martin K. Petersen @ 2020-06-24  4:30 UTC (permalink / raw)
  To: Seungwon Jeon, James E.J. Bottomley, Avri Altman, Alim Akhtar,
	Krzysztof Kozlowski, Kukjin Kim, Kiwoong Kim, Wei Yongjun
  Cc: Martin K . Petersen, linux-samsung-soc, linux-scsi,
	linux-arm-kernel, kernel-janitors, Hulk Robot

On Thu, 18 Jun 2020 13:38:37 +0000, Wei Yongjun wrote:

> In case of error, the function devm_ioremap_resource() returns ERR_PTR()
> and never returns NULL. The NULL test in the return value check should
> be replaced with IS_ERR().

Applied to 5.9/scsi-queue, thanks!

[1/1] scsi: ufs: ufs-exynos: Fix return value check in exynos_ufs_init()
      https://git.kernel.org/mkp/scsi/c/b2bc2200e89b

-- 
Martin K. Petersen	Oracle Linux Engineering

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-06-24  4:32 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <CGME20200618133510epcas5p2e9350caceec46069d21174129af4564a@epcas5p2.samsung.com>
2020-06-18 13:38 ` [PATCH -next] scsi: ufs: ufs-exynos: Fix return value check in exynos_ufs_init() Wei Yongjun
2020-06-21  1:38   ` Alim Akhtar
2020-06-24  4:30   ` Martin K. Petersen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).