[PATCH] twl4030-gpio: Avoid call to a discarded function

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The patch is attached.
Probably there are better ways of doing this like extracting the
cleanup part from __devexited function to another spot. The patch is a
quick one to make it build in non-module, non-hotplug configuration
and to demonstrate the problem.

Mika K
From a8a84a685a5ef108ce4f4fcce37572e99d1c0eb2 Mon Sep 17 00:00:00 2001
From: Mika Korhonen <mika.j.korhonen@xxxxxxxxx>
Date: Wed, 29 Apr 2009 15:25:06 +0300
Subject: [PATCH] twl4030-gpio: Avoid call to a discarded function

gpio_twl4030_remove() is marked to be discarded in certain configurations,
so it cannot be called without checking.

Signed-off-by: Mika Korhonen <mika.j.korhonen@xxxxxxxxx>
---
 drivers/gpio/twl4030-gpio.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/drivers/gpio/twl4030-gpio.c b/drivers/gpio/twl4030-gpio.c
index afad147..4ea9cad 100644
--- a/drivers/gpio/twl4030-gpio.c
+++ b/drivers/gpio/twl4030-gpio.c
@@ -443,11 +443,14 @@ no_irqs:
 
 	ret = gpiochip_add(&twl_gpiochip);
 	if (ret < 0) {
+		int (*remove_fn)(struct platform_device *) = __devexit_p(gpio_twl4030_remove);
 		dev_err(&pdev->dev,
 				"could not register gpiochip, %d\n",
 				ret);
 		twl_gpiochip.ngpio = 0;
-		gpio_twl4030_remove(pdev);
+		if (remove_fn) {
+			remove_fn(pdev);
+		}
 	} else if (pdata->setup) {
 		int status;
 
-- 
1.5.6.5


[Index of Archives]     [Linux Arm (vger)]     [ARM Kernel]     [ARM MSM]     [Linux Tegra]     [Linux WPAN Networking]     [Linux Wireless Networking]     [Maemo Users]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite Trails]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux