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

extcon: ptn5150: Fix return value check in ptn5150_i2c_probe()

In case of error, the function devm_gpiod_get() returns ERR_PTR() and
never returns NULL. The NULL test in the return value check should be
replaced with IS_ERR().

Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>

authored by

Wei Yongjun and committed by
Chanwoo Choi
3dfed895 4ed754de

+4 -4
+4 -4
drivers/extcon/extcon-ptn5150.c
··· 240 240 info->dev = &i2c->dev; 241 241 info->i2c = i2c; 242 242 info->int_gpiod = devm_gpiod_get(&i2c->dev, "int", GPIOD_IN); 243 - if (!info->int_gpiod) { 243 + if (IS_ERR(info->int_gpiod)) { 244 244 dev_err(dev, "failed to get INT GPIO\n"); 245 - return -EINVAL; 245 + return PTR_ERR(info->int_gpiod); 246 246 } 247 247 info->vbus_gpiod = devm_gpiod_get(&i2c->dev, "vbus", GPIOD_IN); 248 - if (!info->vbus_gpiod) { 248 + if (IS_ERR(info->vbus_gpiod)) { 249 249 dev_err(dev, "failed to get VBUS GPIO\n"); 250 - return -EINVAL; 250 + return PTR_ERR(info->vbus_gpiod); 251 251 } 252 252 ret = gpiod_direction_output(info->vbus_gpiod, 0); 253 253 if (ret) {