diff options
author | davidycchen <davidycchen@google.com> | 2022-12-21 15:55:51 +0800 |
---|---|---|
committer | Yen-Chao Chen <davidycchen@google.com> | 2022-12-22 06:09:39 +0000 |
commit | 54a4b79552351c9410a00d29e4a4a57c66c6c432 (patch) | |
tree | d8c85e84e0a5f2581da2f1fc43ba623d5dcf4dad | |
parent | a03f8314b13d88e2300408b7e502bc6ecf1f5196 (diff) | |
download | common-54a4b79552351c9410a00d29e4a4a57c66c6c432.tar.gz |
touch/common: return EPROBE_DEFER when the GPIO is invalid.android-u-preview-1_r0.4android-u-preview-1_r0.2android-gs-raviole-5.10-u-preview-1android-gs-pantah-5.10-u-preview-1
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>
-rw-r--r-- | touch_bus_negotiator.c | 9 |
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; } |