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:45 +0000 |
commit | 31439d6f881db35ca9a32a790069bc68adaab256 (patch) | |
tree | db50cbe17f79845110d47c0db0f8a9b3841a5c2d | |
parent | 60af8f12336967a3684faca2c9dd06d03177da69 (diff) | |
download | common-31439d6f881db35ca9a32a790069bc68adaab256.tar.gz |
touch/common: return EPROBE_DEFER when the GPIO is invalid.
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 31d96b1..2b359f4 100644 --- a/touch_bus_negotiator.c +++ b/touch_bus_negotiator.c @@ -414,6 +414,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); @@ -441,6 +446,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; } @@ -479,6 +485,9 @@ static int tbn_probe(struct platform_device *pdev) dev_info(tbn->dev, "bus negotiator initialized: %pK, mode: %d\n", tbn, tbn->mode); failed: + if (err) + devm_kfree(dev, tbn); + return err; } |