usb: typec: fix an IS_ERR() vs NULL bug in hd3ss3220_probe()
The device_get_named_child_node() function doesn't return error
pointers, it returns NULL on error.
Fixes: 1c48c759ef
("usb: typec: driver for TI HD3SS3220 USB Type-C DRP port controller")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Reviewed-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Link: https://lore.kernel.org/r/20191011185055.GA20972@mwanda
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
67f195806a
commit
c8dd192be8
|
@ -172,8 +172,8 @@ static int hd3ss3220_probe(struct i2c_client *client,
|
||||||
hd3ss3220_set_source_pref(hd3ss3220,
|
hd3ss3220_set_source_pref(hd3ss3220,
|
||||||
HD3SS3220_REG_GEN_CTRL_SRC_PREF_DRP_DEFAULT);
|
HD3SS3220_REG_GEN_CTRL_SRC_PREF_DRP_DEFAULT);
|
||||||
connector = device_get_named_child_node(hd3ss3220->dev, "connector");
|
connector = device_get_named_child_node(hd3ss3220->dev, "connector");
|
||||||
if (IS_ERR(connector))
|
if (!connector)
|
||||||
return PTR_ERR(connector);
|
return -ENODEV;
|
||||||
|
|
||||||
hd3ss3220->role_sw = fwnode_usb_role_switch_get(connector);
|
hd3ss3220->role_sw = fwnode_usb_role_switch_get(connector);
|
||||||
fwnode_handle_put(connector);
|
fwnode_handle_put(connector);
|
||||||
|
|
Loading…
Reference in New Issue