Skip to contentSkip to conversation

gpio: gpio-bt8xx: fix compilation warning

PATCH In review abdoulaye berthe 3 participants 3 messages May 14, 2014 – May 16, 2014

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

PATCH 1/1 gpio: gpio-bt8xx: fix compilation warning

this fixes a compilation warning by checking
the retun value of gpiochip_remove()

---
 drivers/gpio/gpio-bt8xx.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpio/gpio-bt8xx.c +2 -1
index ecb3ca2d..5480229 100644
@@ -240,7 +240,8 @@ static void bt8xxgpio_remove(struct pci_dev *pdev)
 {
 	struct bt8xxgpio *bg = pci_get_drvdata(pdev);
 
-	gpiochip_remove(&bg->gpio);
+	if (gpiochip_remove(&bg->gpio))
+		dev_info(&pdev->dev, "gpiochip_remove() failed.\n");
 
 	bgwrite(0, BT848_INT_MASK);
 	bgwrite(~0x0, BT848_INT_STAT);
Signature · 1 line
1.8.3.2
maintainer
#1 lore raw
Quoted 2 lines · On Wed, 14 May 2014 23:43:36 +0200 abdoulaye berthe <[email protected]> wrote:

this fixes a compilation warning by checking
the retun value of gpiochip_remove()

Really, I would rather change the gpiochip_remove return type to void.

What is the point of printing a useless error message in case
of a failure and then continuing as always.
This is not fixing a compiler warning, it is a workaround. And a bad one, indeed.

How are we supposed to handle a gpiochip_remove failure correctly in a pcidev remove handler?

Quoted 19 lines
---
 drivers/gpio/gpio-bt8xx.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpio/gpio-bt8xx.c +2 -1
index ecb3ca2d..5480229 100644
@@ -240,7 +240,8 @@ static void bt8xxgpio_remove(struct pci_dev *pdev)
 {
 	struct bt8xxgpio *bg = pci_get_drvdata(pdev);
 
-	gpiochip_remove(&bg->gpio);
+	if (gpiochip_remove(&bg->gpio))
+		dev_info(&pdev->dev, "gpiochip_remove() failed.\n");
 
 	bgwrite(0, BT848_INT_MASK);
 	bgwrite(~0x0, BT848_INT_STAT);
Signature · 6 lines
Michael.

----
Please use PGP/GPG encryption.
Key-ID: F532BE1D908D8B0E
--------
#2 lore raw
Quoted 8 lines · Michael Büsch
Quoted 2 lines · On Wed, 14 May 2014 23:43:36 +0200 abdoulaye berthe <[email protected]> wrote:

this fixes a compilation warning by checking
the retun value of gpiochip_remove()

Really, I would rather change the gpiochip_remove return type to void.

Good point.

Dropping this patch in favor of real solution.

Yours,
Linus Walleij