Skip to contentSkip to conversation

video: ocfb: Use devm_platform_ioremap_resource() in ocfb_probe()

PATCH In review Markus Elfring 2 participants 2 messages Sep 19, 2019 – Jan 3, 2020

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 video: ocfb: Use devm_platform_ioremap_resource() in ocfb_probe()

From: Markus Elfring <[email protected]>
Date: Thu, 19 Sep 2019 16:26:56 +0200

Simplify this function implementation by using a known wrapper function.

This issue was detected by using the Coccinelle software.

---
 drivers/video/fbdev/ocfb.c | 9 +--------
 1 file changed, 1 insertion(+), 8 deletions(-)
drivers/video/fbdev/ocfb.c +1 -8
index a970edc2a6f8..be308b4dc91d 100644
@@ -297,7 +297,6 @@ static int ocfb_probe(struct platform_device *pdev)
 {
 	int ret = 0;
 	struct ocfb_dev *fbdev;
-	struct resource *res;
 	int fbsize;
 
 	fbdev = devm_kzalloc(&pdev->dev, sizeof(*fbdev), GFP_KERNEL);
@@ -319,13 +318,7 @@ static int ocfb_probe(struct platform_device *pdev)
 	ocfb_init_var(fbdev);
 	ocfb_init_fix(fbdev);
 
-	/* Request I/O resource */
-	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-	if (!res) {
-		dev_err(&pdev->dev, "I/O resource request failed\n");
-		return -ENXIO;
-	}
-	fbdev->regs = devm_ioremap_resource(&pdev->dev, res);
+	fbdev->regs = devm_platform_ioremap_resource(pdev, 0);
 	if (IS_ERR(fbdev->regs))
 		return PTR_ERR(fbdev->regs);
 

--
2.23.0

#1 lore raw
Quoted 8 lines · Markus Elfring

From: Markus Elfring <[email protected]>
Date: Thu, 19 Sep 2019 16:26:56 +0200

Simplify this function implementation by using a known wrapper function.

This issue was detected by using the Coccinelle software.

Thanks, patch queued for v5.6 (also sorry for the delay).

Best regards,
--
Bartlomiej Zolnierkiewicz
Samsung R&D Institute Poland
Samsung Electronics

Quoted 33 lines
---
 drivers/video/fbdev/ocfb.c | 9 +--------
 1 file changed, 1 insertion(+), 8 deletions(-)
drivers/video/fbdev/ocfb.c +1 -9
index a970edc2a6f8..be308b4dc91d 100644
@@ -297,7 +297,6 @@ static int ocfb_probe(struct platform_device *pdev)
 {
 	int ret = 0;
 	struct ocfb_dev *fbdev;
-	struct resource *res;
 	int fbsize;
 
 	fbdev = devm_kzalloc(&pdev->dev, sizeof(*fbdev), GFP_KERNEL);
@@ -319,13 +318,7 @@ static int ocfb_probe(struct platform_device *pdev)
 	ocfb_init_var(fbdev);
 	ocfb_init_fix(fbdev);
 
-	/* Request I/O resource */
-	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-	if (!res) {
-		dev_err(&pdev->dev, "I/O resource request failed\n");
-		return -ENXIO;
-	}
-	fbdev->regs = devm_ioremap_resource(&pdev->dev, res);
+	fbdev->regs = devm_platform_ioremap_resource(pdev, 0);
 	if (IS_ERR(fbdev->regs))
 		return PTR_ERR(fbdev->regs);
 
--

2.23.0