Skip to contentSkip to conversation

scsi: ufshcd-platform: remove the useless cast in ERR_PTR/IS_ERR

scsi Applied Tomas Winkler 3 participants 3 messages Mar 14, 2017 – Mar 15, 2017 SCSI

lore
Share & tools
lore
#0 lore raw

IS_ERR and ERR_PTR already forcefully cast their argument, hence there is no need for additional (complex) casting.

---
 drivers/scsi/ufs/ufshcd-pltfrm.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/scsi/ufs/ufshcd-pltfrm.c +2 -2
index a72a4ba78125..8e5e6c04c035 100644
@@ -309,8 +309,8 @@ int ufshcd_pltfrm_init(struct platform_device *pdev,
 
 	mem_res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
 	mmio_base = devm_ioremap_resource(dev, mem_res);
-	if (IS_ERR(*(void **)&mmio_base)) {
-		err = PTR_ERR(*(void **)&mmio_base);
+	if (IS_ERR(mmio_base)) {
+		err = PTR_ERR(mmio_base);
 		goto out;
 	}
 
Signature · 1 line
2.9.3
Reviewed-by
#1 lore raw
Quoted 13 lines · Tomas Winkler

IS_ERR and ERR_PTR already forcefully cast their argument, hence there is no need for additional (complex) casting.

---
 drivers/scsi/ufs/ufshcd-pltfrm.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/scsi/ufs/ufshcd-pltfrm.c +0 -0
index a72a4ba78125..8e5e6c04c035 100644

drivers/scsi/ufs/ufshcd-pltfrm.c int ufshcd_pltfrm_init(struct platform_device · line 316

Quoted 10 lines
drivers/scsi/ufs/ufshcd-pltfrm.c +2 -2
@@ -309,8 +309,8 @@ int ufshcd_pltfrm_init(struct platform_device 
 *pdev,
 
 	mem_res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
 	mmio_base = devm_ioremap_resource(dev, mem_res);
-	if (IS_ERR(*(void **)&mmio_base)) {
-		err = PTR_ERR(*(void **)&mmio_base);
+	if (IS_ERR(mmio_base)) {
+		err = PTR_ERR(mmio_base);
 		goto out;
 	}

LGTM.

Signature · 2 lines
The Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
a Linux Foundation Collaborative Project
#2 lore raw
In reply to Tomas Winkler
Quoted 2 lines · Tomas Winkler

IS_ERR and ERR_PTR already forcefully cast their argument, hence there is no need for additional (complex) casting.

Applied to 4.11/scsi-fixes.

Signature · 1 line
Martin K. Petersen	Oracle Linux Engineering