]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
ENGR00286971-1 imx6q: add sanity check for getting gpio for flexcan
authorDong Aisheng <b29396@freescale.com>
Fri, 8 Nov 2013 07:48:23 +0000 (15:48 +0800)
committerRobin Gong <b38343@freescale.com>
Fri, 30 Jan 2015 02:01:00 +0000 (10:01 +0800)
This is used to avoid a warning:
WARNING: at /home/b29397/work/projects/linux-2.6-imx/drivers/gpio/gpiolib.c:126
gpio_to_desc+0x30/0x44()
invalid GPIO -517
Modules linked in:
....
gpiod_request: invalid GPIO

Signed-off-by: Dong Aisheng <b29396@freescale.com>
(cherry picked from commit e644b009e6e127f028f3a2708585fa867a9db35c)

arch/arm/mach-imx/mach-imx6q.c

index cc8715c526d5adc82097a23ffe1ba3320f89b3ae..30a4aef274c3cdd7d2a51f7edf7328cca0ae45d5 100644 (file)
@@ -125,7 +125,8 @@ static int __init imx6q_flexcan_fixup_auto(void)
 
        flexcan_en_gpio = of_get_named_gpio(np, "trx-en-gpio", 0);
        flexcan_stby_gpio = of_get_named_gpio(np, "trx-stby-gpio", 0);
-       if (!gpio_request_one(flexcan_en_gpio, GPIOF_DIR_OUT, "flexcan-trx-en") &&
+       if (gpio_is_valid(flexcan_en_gpio) && gpio_is_valid(flexcan_stby_gpio) &&
+               !gpio_request_one(flexcan_en_gpio, GPIOF_DIR_OUT, "flexcan-trx-en") &&
                !gpio_request_one(flexcan_stby_gpio, GPIOF_DIR_OUT, "flexcan-trx-stby")) {
                /* flexcan 0 & 1 are using the same GPIOs for transceiver */
                flexcan_pdata[0].transceiver_switch = imx6q_flexcan0_switch_auto;