usb: typec: tps6598x: Fix return value check in tps6598x_probe()
Subsystems (3)
PATCH 1/1 usb: typec: tps6598x: Fix return value check in tps6598x_probe()
From: Wei Yongjun <[email protected]>
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 <[email protected]>
Signed-off-by Wei Yongjun <[email protected]>
--- drivers/usb/typec/tps6598x.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/usb/typec/tps6598x.c +2 -2
@@ -629,8 +629,8 @@ static int tps6598x_probe(struct i2c_client *client)return ret; fwnode =device_get_named_child_node (&client->dev,"connector" ); -if (IS_ERR (fwnode)) -return PTR_ERR (fwnode); +if (!fwnode) +return -ENODEV ; tps->role_sw =fwnode_usb_role_switch_get (fwnode);if (IS_ERR (tps->role_sw)) {
Quoted 9 lines · Wei Yongjun
From: Wei Yongjun <[email protected]>
In case of error, the function
device_get_named_child_node()returns NULL pointer notERR_PTR(). TheIS_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 <[email protected]>Signed-off-by Wei Yongjun <[email protected]>
Reviewed-by Heikki Krogerus <[email protected]>
Quoted 9 lines
--- drivers/usb/typec/tps6598x.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)drivers/usb/typec/tps6598x.c +0
-0
drivers/usb/typec/tps6598x.c static int tps6598x_probe(struct i2c_client *client) · line 636
Quoted 10 lines
drivers/usb/typec/tps6598x.c +2
-2@@ -629,8 +629,8 @@ static int tps6598x_probe(struct i2c_client *client)return ret; fwnode =device_get_named_child_node (&client->dev,"connector" ); -if (IS_ERR (fwnode)) -return PTR_ERR (fwnode); +if (!fwnode) +return -ENODEV ; tps->role_sw =fwnode_usb_role_switch_get (fwnode);if (IS_ERR (tps->role_sw)) {
thanks,
Signature · 1 line
heikki