Skip to contentSkip to conversation

pinctrl/spear/plgpio: Delete two error messages for a failed memory allocation in plgpio_probe()

PATCH In review SF Markus Elfring 3 participants 3 messages Dec 27, 2017 – Jan 2, 2018

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

PATCH 1/1 pinctrl/spear/plgpio: Delete two error messages for a failed memory allocation in plgpio_probe()

From: Markus Elfring <[email protected]>
Date: Wed, 27 Dec 2017 22:34:28 +0100

Omit extra messages for a memory allocation failure in this function.

This issue was detected by using the Coccinelle software.

---
 drivers/pinctrl/spear/pinctrl-plgpio.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)
drivers/pinctrl/spear/pinctrl-plgpio.c +2 -6
index 6a0ed8ab33b9..d2123e396b29 100644
@@ -519,10 +519,8 @@ static int plgpio_probe(struct platform_device *pdev)
 	int ret, irq;
 
 	plgpio = devm_kzalloc(&pdev->dev, sizeof(*plgpio), GFP_KERNEL);
-	if (!plgpio) {
-		dev_err(&pdev->dev, "memory allocation fail\n");
+	if (!plgpio)
 		return -ENOMEM;
-	}
 
 	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
 	plgpio->base = devm_ioremap_resource(&pdev->dev, res);
@@ -544,10 +542,8 @@ static int plgpio_probe(struct platform_device *pdev)
 			sizeof(*plgpio->csave_regs) *
 			DIV_ROUND_UP(plgpio->chip.ngpio, MAX_GPIO_PER_REG),
 			GFP_KERNEL);
-	if (!plgpio->csave_regs) {
-		dev_err(&pdev->dev, "csave registers memory allocation fail\n");
+	if (!plgpio->csave_regs)
 		return -ENOMEM;
-	}
 #endif
 
 	platform_set_drvdata(pdev, plgpio);
Signature · 1 line
2.15.1
Acked-by on v1 1/1
#1 lore raw
Quoted 30 lines · SF Markus Elfring

From: Markus Elfring <[email protected]>
Date: Wed, 27 Dec 2017 22:34:28 +0100

Omit extra messages for a memory allocation failure in this function.

This issue was detected by using the Coccinelle software.

---
 drivers/pinctrl/spear/pinctrl-plgpio.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)
drivers/pinctrl/spear/pinctrl-plgpio.c +1 -3
index 6a0ed8ab33b9..d2123e396b29 100644
@@ -519,10 +519,8 @@ static int plgpio_probe(struct platform_device *pdev)
 	int ret, irq;
 
 	plgpio = devm_kzalloc(&pdev->dev, sizeof(*plgpio), GFP_KERNEL);
-	if (!plgpio) {
-		dev_err(&pdev->dev, "memory allocation fail\n");
+	if (!plgpio)
 		return -ENOMEM;
-	}
 
 	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
 	plgpio->base = devm_ioremap_resource(&pdev->dev, res);
@@ -544,10 +542,8 @@ static int plgpio_probe(struct platform_device *pdev)
 			sizeof(*plgpio->csave_regs) *

drivers/pinctrl/spear/pinctrl-plgpio.c static int plgpio_probe(struct platform_device *pdev) · line 549

Quoted 10 lines
drivers/pinctrl/spear/pinctrl-plgpio.c +1 -3
 			DIV_ROUND_UP(plgpio->chip.ngpio, MAX_GPIO_PER_REG),
 			GFP_KERNEL);
-	if (!plgpio->csave_regs) {
-		dev_err(&pdev->dev, "csave registers memory allocation fail\n");
+	if (!plgpio->csave_regs)
 		return -ENOMEM;
-	}
 #endif
 
 	platform_set_drvdata(pdev, plgpio);
Signature · 1 line
viresh