summaryrefslogtreecommitdiff
path: root/touch_bus_negotiator.c
diff options
context:
space:
mode:
authordavidycchen <davidycchen@google.com>2022-12-21 15:55:51 +0800
committerYen-Chao Chen <davidycchen@google.com>2022-12-22 06:09:39 +0000
commit54a4b79552351c9410a00d29e4a4a57c66c6c432 (patch)
treed8c85e84e0a5f2581da2f1fc43ba623d5dcf4dad /touch_bus_negotiator.c
parenta03f8314b13d88e2300408b7e502bc6ecf1f5196 (diff)
downloadcommon-54a4b79552351c9410a00d29e4a4a57c66c6c432.tar.gz
The GPIO may be invalid when this module loads before pinctrl module so return EPROBE_DEFER for retry. Bug: 263205231 Test: no kernel panic Change-Id: Ibe4910ce2015ab464faf3ee35b4fb06524a6512a Signed-off-by: davidycchen <davidycchen@google.com>
Diffstat (limited to 'touch_bus_negotiator.c')
-rw-r--r--touch_bus_negotiator.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/touch_bus_negotiator.c b/touch_bus_negotiator.c
index cae8435..94d7134 100644
--- a/touch_bus_negotiator.c
+++ b/touch_bus_negotiator.c
@@ -263,6 +263,11 @@ static int tbn_probe(struct platform_device *pdev)
__func__, tbn->ap2aoc_gpio, err);
goto failed;
}
+ } else {
+ dev_err(tbn->dev, "%s: invalid ap2aoc_gpio %d!\n",
+ __func__, tbn->ap2aoc_gpio);
+ err = -EPROBE_DEFER;
+ goto failed;
}
tbn->aoc2ap_gpio = of_get_named_gpio(np, "tbn,aoc2ap_gpio", 0);
@@ -290,6 +295,7 @@ static int tbn_probe(struct platform_device *pdev)
} else {
dev_err(tbn->dev, "%s: invalid aoc2ap_gpio %d!\n",
__func__, tbn->aoc2ap_gpio);
+ err = -EPROBE_DEFER;
goto failed;
}
} else {
@@ -310,6 +316,9 @@ static int tbn_probe(struct platform_device *pdev)
dev_dbg(tbn->dev, "bus negotiator initialized: %pK\n", tbn);
failed:
+ if (err)
+ devm_kfree(dev, tbn);
+
return err;
}