Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

regulator: tps65132: Stop parsing DT when gpio is not found

In case of a missing (optional) gpio don't fall through up to
"ti,active-discharge-time-us" due to
devm_fwnode_get_index_gpiod_from_child() returning NULL (since
gpiod_get_from_of_node() returned NULL) but rather indicate success as
intended.

This makes the driver probe correctly when e.g. only the enable gpio is
given.

Signed-off-by: Guido Günther <agx@sigxcpu.org>
Link: https://lore.kernel.org/r/363bd50cc7c60daa57d614a341d1fd649f05194c.1567625660.git.agx@sigxcpu.org
Signed-off-by: Mark Brown <broonie@kernel.org>

authored by

Guido Günther and committed by
Mark Brown
a9574467 55576cf1

+2 -2
+2 -2
drivers/regulator/tps65132-regulator.c
··· 138 138 139 139 rpdata->en_gpiod = devm_fwnode_get_index_gpiod_from_child(tps->dev, 140 140 "enable", 0, &np->fwnode, 0, "enable"); 141 - if (IS_ERR(rpdata->en_gpiod)) { 141 + if (IS_ERR_OR_NULL(rpdata->en_gpiod)) { 142 142 ret = PTR_ERR(rpdata->en_gpiod); 143 143 144 144 /* Ignore the error other than probe defer */ ··· 150 150 rpdata->act_dis_gpiod = devm_fwnode_get_index_gpiod_from_child( 151 151 tps->dev, "active-discharge", 0, 152 152 &np->fwnode, 0, "active-discharge"); 153 - if (IS_ERR(rpdata->act_dis_gpiod)) { 153 + if (IS_ERR_OR_NULL(rpdata->act_dis_gpiod)) { 154 154 ret = PTR_ERR(rpdata->act_dis_gpiod); 155 155 156 156 /* Ignore the error other than probe defer */