summaryrefslogtreecommitdiffstats
path: root/drivers/usb/typec/hd3ss3220.c
diff options
context:
space:
mode:
authorBiju Das <biju.das@bp.renesas.com>2019-10-07 16:38:49 +0100
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2019-10-10 12:34:07 +0200
commit5a9a8a4c505851cfb1fe5772851fb528476575bb (patch)
treeec77cc82d54c4d028d657a1b5fa7fc6ac1909a6a /drivers/usb/typec/hd3ss3220.c
parenta4f55d8b8c146f9d99fe004bc9d1403d4c149ae3 (diff)
downloadlinux-stable-5a9a8a4c505851cfb1fe5772851fb528476575bb.tar.gz
linux-stable-5a9a8a4c505851cfb1fe5772851fb528476575bb.tar.bz2
linux-stable-5a9a8a4c505851cfb1fe5772851fb528476575bb.zip
usb: typec: hd3ss3220: hd3ss3220_probe() warn: passing zero to 'PTR_ERR'
This patch fixes the warning passing zero to 'PTR_ERR' by changing the check from 'IS_ERR_OR_NULL' to 'IS_ERR'. Also improved the error handling on probe function. Fixes: 1c48c759ef4b ("usb: typec: driver for TI HD3SS3220 USB Type-C DRP port controller") Reported-by: kbuild test robot <lkp@intel.com> Reported-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Biju Das <biju.das@bp.renesas.com> Reviewed-by: Heikki Krogerus <heikki.krogerus@linux.intel.com> Link: https://lore.kernel.org/r/1570462729-25722-1-git-send-email-biju.das@bp.renesas.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/usb/typec/hd3ss3220.c')
-rw-r--r--drivers/usb/typec/hd3ss3220.c19
1 files changed, 11 insertions, 8 deletions
diff --git a/drivers/usb/typec/hd3ss3220.c b/drivers/usb/typec/hd3ss3220.c
index 1900910c637e..7e5f3f73f6f4 100644
--- a/drivers/usb/typec/hd3ss3220.c
+++ b/drivers/usb/typec/hd3ss3220.c
@@ -178,7 +178,7 @@ static int hd3ss3220_probe(struct i2c_client *client,
hd3ss3220->role_sw = fwnode_usb_role_switch_get(connector);
fwnode_handle_put(connector);
- if (IS_ERR_OR_NULL(hd3ss3220->role_sw))
+ if (IS_ERR(hd3ss3220->role_sw))
return PTR_ERR(hd3ss3220->role_sw);
hd3ss3220->typec_cap.prefer_role = TYPEC_NO_PREFERRED_ROLE;
@@ -188,20 +188,22 @@ static int hd3ss3220_probe(struct i2c_client *client,
hd3ss3220->port = typec_register_port(&client->dev,
&hd3ss3220->typec_cap);
- if (IS_ERR(hd3ss3220->port))
- return PTR_ERR(hd3ss3220->port);
+ if (IS_ERR(hd3ss3220->port)) {
+ ret = PTR_ERR(hd3ss3220->port);
+ goto err_put_role;
+ }
hd3ss3220_set_role(hd3ss3220);
ret = regmap_read(hd3ss3220->regmap, HD3SS3220_REG_CN_STAT_CTRL, &data);
if (ret < 0)
- goto error;
+ goto err_unreg_port;
if (data & HD3SS3220_REG_CN_STAT_CTRL_INT_STATUS) {
ret = regmap_write(hd3ss3220->regmap,
HD3SS3220_REG_CN_STAT_CTRL,
data | HD3SS3220_REG_CN_STAT_CTRL_INT_STATUS);
if (ret < 0)
- goto error;
+ goto err_unreg_port;
}
if (client->irq > 0) {
@@ -210,18 +212,19 @@ static int hd3ss3220_probe(struct i2c_client *client,
IRQF_TRIGGER_FALLING | IRQF_ONESHOT,
"hd3ss3220", &client->dev);
if (ret)
- goto error;
+ goto err_unreg_port;
}
ret = i2c_smbus_read_byte_data(client, HD3SS3220_REG_DEV_REV);
if (ret < 0)
- goto error;
+ goto err_unreg_port;
dev_info(&client->dev, "probed revision=0x%x\n", ret);
return 0;
-error:
+err_unreg_port:
typec_unregister_port(hd3ss3220->port);
+err_put_role:
usb_role_switch_put(hd3ss3220->role_sw);
return ret;