Linux-SCSI Archive on lore.kernel.org
 help / color / Atom feed
* [PATCH] scsi: ufs-hisi: Use PTR_ERR_OR_ZERO() in ufs_hisi_get_resource()
@ 2019-09-07 12:36 Markus Elfring
  2019-09-11 12:55 ` Avri Altman
  0 siblings, 1 reply; 2+ messages in thread
From: Markus Elfring @ 2019-09-07 12:36 UTC (permalink / raw)
  To: linux-scsi, Alim Akhtar, Allison Randal, Arnd Bergmann,
	Avri Altman, Greg Kroah-Hartman, James E. J. Bottomley,
	Kangjie Lu, Manivannan Sadhasivam, Martin K. Petersen,
	Pedro Sousa, Stanley Chu, Thomas Gleixner, Wei Li
  Cc: LKML, kernel-janitors

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Sat, 7 Sep 2019 14:25:31 +0200

Simplify this function implementation by using a known function.

Generated by: scripts/coccinelle/api/ptr_ret.cocci

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
 drivers/scsi/ufs/ufs-hisi.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/drivers/scsi/ufs/ufs-hisi.c b/drivers/scsi/ufs/ufs-hisi.c
index f4d1dca962c4..a0ea57c19dbc 100644
--- a/drivers/scsi/ufs/ufs-hisi.c
+++ b/drivers/scsi/ufs/ufs-hisi.c
@@ -454,10 +454,7 @@ static int ufs_hisi_get_resource(struct ufs_hisi_host *host)
 	/* get resource of ufs sys ctrl */
 	mem_res = platform_get_resource(pdev, IORESOURCE_MEM, 1);
 	host->ufs_sys_ctrl = devm_ioremap_resource(dev, mem_res);
-	if (IS_ERR(host->ufs_sys_ctrl))
-		return PTR_ERR(host->ufs_sys_ctrl);
-
-	return 0;
+	return PTR_ERR_OR_ZERO(host->ufs_sys_ctrl);
 }

 static void ufs_hisi_set_pm_lvl(struct ufs_hba *hba)
--
2.23.0


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

* RE: [PATCH] scsi: ufs-hisi: Use PTR_ERR_OR_ZERO() in ufs_hisi_get_resource()
  2019-09-07 12:36 [PATCH] scsi: ufs-hisi: Use PTR_ERR_OR_ZERO() in ufs_hisi_get_resource() Markus Elfring
@ 2019-09-11 12:55 ` Avri Altman
  0 siblings, 0 replies; 2+ messages in thread
From: Avri Altman @ 2019-09-11 12:55 UTC (permalink / raw)
  To: Markus Elfring, linux-scsi, Alim Akhtar, Allison Randal,
	Arnd Bergmann, Greg Kroah-Hartman, James E. J. Bottomley,
	Kangjie Lu, Manivannan Sadhasivam, Martin K. Petersen,
	Pedro Sousa, Stanley Chu, Thomas Gleixner, Wei Li
  Cc: LKML, kernel-janitors

> 
> From: Markus Elfring <elfring@users.sourceforge.net>
> Date: Sat, 7 Sep 2019 14:25:31 +0200
> 
> Simplify this function implementation by using a known function.
> 
> Generated by: scripts/coccinelle/api/ptr_ret.cocci
> 
> Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
Reviewed-by: Avri Altman <avri.altman@wdc.com>

> ---
>  drivers/scsi/ufs/ufs-hisi.c | 5 +----
>  1 file changed, 1 insertion(+), 4 deletions(-)
> 
> diff --git a/drivers/scsi/ufs/ufs-hisi.c b/drivers/scsi/ufs/ufs-hisi.c index
> f4d1dca962c4..a0ea57c19dbc 100644
> --- a/drivers/scsi/ufs/ufs-hisi.c
> +++ b/drivers/scsi/ufs/ufs-hisi.c
> @@ -454,10 +454,7 @@ static int ufs_hisi_get_resource(struct ufs_hisi_host
> *host)
>         /* get resource of ufs sys ctrl */
>         mem_res = platform_get_resource(pdev, IORESOURCE_MEM, 1);
>         host->ufs_sys_ctrl = devm_ioremap_resource(dev, mem_res);
> -       if (IS_ERR(host->ufs_sys_ctrl))
> -               return PTR_ERR(host->ufs_sys_ctrl);
> -
> -       return 0;
> +       return PTR_ERR_OR_ZERO(host->ufs_sys_ctrl);
>  }
> 
>  static void ufs_hisi_set_pm_lvl(struct ufs_hba *hba)
> --
> 2.23.0


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

end of thread, back to index

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-09-07 12:36 [PATCH] scsi: ufs-hisi: Use PTR_ERR_OR_ZERO() in ufs_hisi_get_resource() Markus Elfring
2019-09-11 12:55 ` Avri Altman

Linux-SCSI Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-scsi/0 linux-scsi/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-scsi linux-scsi/ https://lore.kernel.org/linux-scsi \
		linux-scsi@vger.kernel.org linux-scsi@archiver.kernel.org
	public-inbox-index linux-scsi


Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-scsi


AGPL code for this site: git clone https://public-inbox.org/ public-inbox