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

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: a867bde3dd03 ("regulator: slg51000: add slg51000 regulator driver")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Link: https://lore.kernel.org/r/20190808103335.GD30506@mwanda
Signed-off-by: Mark Brown <broonie@kernel.org>

authored by

Dan Carpenter and committed by
Mark Brown
7352e72a 811ba489

+2 -2
+2 -2
drivers/regulator/slg51000-regulator.c
··· 205 205 ena_gpiod = devm_gpiod_get_from_of_node(chip->dev, np, 206 206 "enable-gpios", 0, 207 207 gflags, "gpio-en-ldo"); 208 - if (ena_gpiod) { 208 + if (!IS_ERR(ena_gpiod)) { 209 209 config->ena_gpiod = ena_gpiod; 210 210 devm_gpiod_unhinge(chip->dev, config->ena_gpiod); 211 211 } ··· 459 459 GPIOD_OUT_HIGH 460 460 | GPIOD_FLAGS_BIT_NONEXCLUSIVE, 461 461 "slg51000-cs"); 462 - if (cs_gpiod) { 462 + if (!IS_ERR(cs_gpiod)) { 463 463 dev_info(dev, "Found chip selector property\n"); 464 464 chip->cs_gpiod = cs_gpiod; 465 465 }