Skip to content

Commit 7352e72

Browse files
Dan Carpenterbroonie
authored andcommitted
regulator: slg51000: Fix a couple NULL vs IS_ERR() checks
The devm_gpiod_get_from_of_node() function never returns NULL, it returns error pointers on error. Fixes: a867bde ("regulator: slg51000: add slg51000 regulator driver") Signed-off-by: Dan Carpenter <[email protected]> Link: https://lore.kernel.org/r/20190808103335.GD30506@mwanda Signed-off-by: Mark Brown <[email protected]>
1 parent 811ba48 commit 7352e72

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

drivers/regulator/slg51000-regulator.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,7 @@ static int slg51000_of_parse_cb(struct device_node *np,
205205
ena_gpiod = devm_gpiod_get_from_of_node(chip->dev, np,
206206
"enable-gpios", 0,
207207
gflags, "gpio-en-ldo");
208-
if (ena_gpiod) {
208+
if (!IS_ERR(ena_gpiod)) {
209209
config->ena_gpiod = ena_gpiod;
210210
devm_gpiod_unhinge(chip->dev, config->ena_gpiod);
211211
}
@@ -459,7 +459,7 @@ static int slg51000_i2c_probe(struct i2c_client *client,
459459
GPIOD_OUT_HIGH
460460
| GPIOD_FLAGS_BIT_NONEXCLUSIVE,
461461
"slg51000-cs");
462-
if (cs_gpiod) {
462+
if (!IS_ERR(cs_gpiod)) {
463463
dev_info(dev, "Found chip selector property\n");
464464
chip->cs_gpiod = cs_gpiod;
465465
}

0 commit comments

Comments
 (0)