All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH -next] usb: typec: tps6598x: Fix return value check in tps6598x_probe()
@ 2021-03-08  9:48 'Wei Yongjun
  2021-03-08 11:04 ` Heikki Krogerus
  0 siblings, 1 reply; 2+ messages in thread
From: 'Wei Yongjun @ 2021-03-08  9:48 UTC (permalink / raw)
  To: weiyongjun1, Heikki Krogerus, Greg Kroah-Hartman, Bryan O'Donoghue
  Cc: linux-usb, kernel-janitors, Hulk Robot

From: Wei Yongjun <weiyongjun1@huawei.com>

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>
Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
---
 drivers/usb/typec/tps6598x.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/usb/typec/tps6598x.c b/drivers/usb/typec/tps6598x.c
index a4ec8e56c2b9..2c4ab90e16e7 100644
--- a/drivers/usb/typec/tps6598x.c
+++ b/drivers/usb/typec/tps6598x.c
@@ -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)) {


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH -next] usb: typec: tps6598x: Fix return value check in tps6598x_probe()
  2021-03-08  9:48 [PATCH -next] usb: typec: tps6598x: Fix return value check in tps6598x_probe() 'Wei Yongjun
@ 2021-03-08 11:04 ` Heikki Krogerus
  0 siblings, 0 replies; 2+ messages in thread
From: Heikki Krogerus @ 2021-03-08 11:04 UTC (permalink / raw)
  To: 'Wei Yongjun
  Cc: Greg Kroah-Hartman, Bryan O'Donoghue, linux-usb,
	kernel-janitors, Hulk Robot

On Mon, Mar 08, 2021 at 09:48:41AM +0000, 'Wei Yongjun wrote:
> From: Wei Yongjun <weiyongjun1@huawei.com>
> 
> 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>
> Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>

Reviewed-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>

> ---
>  drivers/usb/typec/tps6598x.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/usb/typec/tps6598x.c b/drivers/usb/typec/tps6598x.c
> index a4ec8e56c2b9..2c4ab90e16e7 100644
> --- a/drivers/usb/typec/tps6598x.c
> +++ b/drivers/usb/typec/tps6598x.c
> @@ -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,

-- 
heikki

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-03-08 11:05 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-08  9:48 [PATCH -next] usb: typec: tps6598x: Fix return value check in tps6598x_probe() 'Wei Yongjun
2021-03-08 11:04 ` Heikki Krogerus

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.