Commit 7352e72a authored by Dan Carpenter's avatar Dan Carpenter Committed by Mark Brown

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: a867bde3 ("regulator: slg51000: add slg51000 regulator driver")
Signed-off-by: default avatarDan Carpenter <dan.carpenter@oracle.com>
Link: https://lore.kernel.org/r/20190808103335.GD30506@mwandaSigned-off-by: default avatarMark Brown <broonie@kernel.org>
parent 811ba489
......@@ -205,7 +205,7 @@ static int slg51000_of_parse_cb(struct device_node *np,
ena_gpiod = devm_gpiod_get_from_of_node(chip->dev, np,
"enable-gpios", 0,
gflags, "gpio-en-ldo");
if (ena_gpiod) {
if (!IS_ERR(ena_gpiod)) {
config->ena_gpiod = ena_gpiod;
devm_gpiod_unhinge(chip->dev, config->ena_gpiod);
}
......@@ -459,7 +459,7 @@ static int slg51000_i2c_probe(struct i2c_client *client,
GPIOD_OUT_HIGH
| GPIOD_FLAGS_BIT_NONEXCLUSIVE,
"slg51000-cs");
if (cs_gpiod) {
if (!IS_ERR(cs_gpiod)) {
dev_info(dev, "Found chip selector property\n");
chip->cs_gpiod = cs_gpiod;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment