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

usb: typec: tps6598x: Fix return value check in tps6598x_probe()

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

Fixes: 18a6c866bb19 ("usb: typec: tps6598x: Add USB role switching logic")
Reported-by: Hulk Robot <hulkci@huawei.com>
Reviewed-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
Link: https://lore.kernel.org/r/20210308094841.3587751-1-weiyongjun1@huawei.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Wei Yongjun and committed by
Greg Kroah-Hartman
604c7589 493d0856

+2 -2
+2 -2
drivers/usb/typec/tps6598x.c
··· 629 629 return ret; 630 630 631 631 fwnode = device_get_named_child_node(&client->dev, "connector"); 632 - if (IS_ERR(fwnode)) 633 - return PTR_ERR(fwnode); 632 + if (!fwnode) 633 + return -ENODEV; 634 634 635 635 tps->role_sw = fwnode_usb_role_switch_get(fwnode); 636 636 if (IS_ERR(tps->role_sw)) {