cip-dev.lists.cip-project.org archive mirror
 help / color / mirror / Atom feed
From: marian-cristian.rotariu.rb@bp.renesas.com (Marian-Cristian Rotariu)
To: cip-dev@lists.cip-project.org
Subject: [cip-dev] [PATCH 4.19.y-cip 18/23] usb: typec: hd3ss3220: hd3ss3220_probe() warn: passing zero to 'PTR_ERR'
Date: Tue, 18 Feb 2020 14:05:15 +0000	[thread overview]
Message-ID: <1582034720-5249-19-git-send-email-marian-cristian.rotariu.rb@bp.renesas.com> (raw)
In-Reply-To: <1582034720-5249-1-git-send-email-marian-cristian.rotariu.rb@bp.renesas.com>

From: Biju Das <biju.das@bp.renesas.com>

commit 5a9a8a4c505851cfb1fe5772851fb528476575bb upstream.

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 at bp.renesas.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Marian-Cristian Rotariu <marian-cristian.rotariu.rb@bp.renesas.com>
---
 drivers/usb/typec/hd3ss3220.c | 19 +++++++++++--------
 1 file changed, 11 insertions(+), 8 deletions(-)

diff --git a/drivers/usb/typec/hd3ss3220.c b/drivers/usb/typec/hd3ss3220.c
index 658e6aa..0b28ca9 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;
-- 
2.7.4

  parent reply	other threads:[~2020-02-18 14:05 UTC|newest]

Thread overview: 46+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-18 14:04 [cip-dev] [PATCH 4.19.y-cip 00/23] Renesas RZ/G2E USB Type-C Backport Marian-Cristian Rotariu
2020-02-18 14:04 ` [cip-dev] [PATCH 4.19.y-cip 01/23] device connection: Add fwnode member to struct device_connection Marian-Cristian Rotariu
2020-02-19  7:42   ` Pavel Machek
2020-02-19 19:11     ` Marian-Cristian Rotariu
2020-02-18 14:04 ` [cip-dev] [PATCH 4.19.y-cip 02/23] usb: typec: mux: Find the muxes by also matching against the device node Marian-Cristian Rotariu
2020-02-18 14:05 ` [cip-dev] [PATCH 4.19.y-cip 03/23] usb: typec: mux: Fix unsigned comparison with less than zero Marian-Cristian Rotariu
2020-02-18 14:05 ` [cip-dev] [PATCH 4.19.y-cip 04/23] usb: roles: Find the muxes by also matching against the device node Marian-Cristian Rotariu
2020-02-19  7:51   ` Pavel Machek
2020-02-19 19:04     ` Marian-Cristian Rotariu
2020-02-19 21:38       ` Pavel Machek
2020-02-18 14:05 ` [cip-dev] [PATCH 4.19.y-cip 05/23] usb: typec: Find the ports " Marian-Cristian Rotariu
2020-02-19  7:56   ` Pavel Machek
2020-02-20 10:44     ` [cip-dev] " Marian-Cristian Rotariu
2020-02-18 14:05 ` [cip-dev] [PATCH 4.19.y-cip 06/23] device connection: Prepare support for firmware described connections Marian-Cristian Rotariu
2020-02-18 14:05 ` [cip-dev] [PATCH 4.19.y-cip 07/23] device connection: Find device connections also from device graphs Marian-Cristian Rotariu
2020-02-18 14:05 ` [cip-dev] [PATCH 4.19.y-cip 08/23] device property: Introduce fwnode_find_reference() Marian-Cristian Rotariu
2020-02-18 14:05 ` [cip-dev] [PATCH 4.19.y-cip 09/23] device connection: Find connections also by checking the references Marian-Cristian Rotariu
2020-02-18 14:05 ` [cip-dev] [PATCH 4.19.y-cip 10/23] usb: roles: Introduce stubs for the exiting functions in role.h Marian-Cristian Rotariu
2020-02-18 14:05 ` [cip-dev] [PATCH 4.19.y-cip 11/23] device connection: Add fwnode_connection_find_match() Marian-Cristian Rotariu
2020-02-18 14:05 ` [cip-dev] [PATCH 4.19.y-cip 12/23] usb: roles: Add fwnode_usb_role_switch_get() function Marian-Cristian Rotariu
2020-02-18 14:05 ` [cip-dev] [PATCH 4.19.y-cip 13/23] dt-bindings: usb: hd3ss3220 device tree binding document Marian-Cristian Rotariu
2020-02-18 14:05 ` [cip-dev] [PATCH 4.19.y-cip 14/23] dt-bindings: usb: renesas_usb3: Document usb role switch support Marian-Cristian Rotariu
2020-02-18 14:05 ` [cip-dev] [PATCH 4.19.y-cip 15/23] usb: typec: driver for TI HD3SS3220 USB Type-C DRP port controller Marian-Cristian Rotariu
2020-02-19  8:12   ` Pavel Machek
2020-02-20 11:20     ` [cip-dev] " Marian-Cristian Rotariu
2020-02-20 15:46       ` Pavel Machek
2020-02-20 16:28         ` Marian-Cristian Rotariu
2020-02-18 14:05 ` [cip-dev] [PATCH 4.19.y-cip 16/23] usb: typec: hd3ss3220_irq() can be static Marian-Cristian Rotariu
2020-02-19  8:20   ` Pavel Machek
2020-02-19 19:15     ` Marian-Cristian Rotariu
2020-02-19 21:40       ` Pavel Machek
2020-02-18 14:05 ` [cip-dev] [PATCH 4.19.y-cip 17/23] usb: typec: add dependency for TYPEC_HD3SS3220 Marian-Cristian Rotariu
2020-02-19  8:16   ` Pavel Machek
2020-02-20 11:40     ` [cip-dev] " Marian-Cristian Rotariu
2020-02-20 15:50       ` Pavel Machek
2020-02-18 14:05 ` Marian-Cristian Rotariu [this message]
2020-02-18 14:05 ` [cip-dev] [PATCH 4.19.y-cip 19/23] usb: typec: fix an IS_ERR() vs NULL bug in hd3ss3220_probe() Marian-Cristian Rotariu
2020-02-18 14:05 ` [cip-dev] [PATCH 4.19.y-cip 20/23] usb: gadget: udc: renesas_usb3: Enhance role switch support Marian-Cristian Rotariu
2020-02-18 14:05 ` [cip-dev] [PATCH 4.19.y-cip 21/23] arm64: defconfig: enable TYPEC_HD3SS3220 config option Marian-Cristian Rotariu
2020-02-19  8:19   ` Pavel Machek
2020-02-19 19:18     ` Marian-Cristian Rotariu
2020-02-18 14:05 ` [cip-dev] [PATCH 4.19.y-cip 22/23] arm64: dts: renesas: cat874: Enable USB3.0 host/peripheral device node Marian-Cristian Rotariu
2020-02-18 14:05 ` [cip-dev] [PATCH 4.19.y-cip 23/23] arm64: dts: renesas: cat874: Enable usb role switch support Marian-Cristian Rotariu
2020-02-19  7:41 ` [PATCH 4.19.y-cip 00/23] Renesas RZ/G2E USB Type-C Backport Pavel Machek
2020-02-19 18:43   ` Marian-Cristian Rotariu
2020-02-19 21:35     ` Pavel Machek

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1582034720-5249-19-git-send-email-marian-cristian.rotariu.rb@bp.renesas.com \
    --to=marian-cristian.rotariu.rb@bp.renesas.com \
    --cc=cip-dev@lists.cip-project.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).