diff mbox series

[1/2] usb: typec: stusb160x: fix an IS_ERR() vs NULL check in probe

Message ID 20201023112347.GC282278@mwanda
State New
Headers show
Series [1/2] usb: typec: stusb160x: fix an IS_ERR() vs NULL check in probe | expand

Commit Message

Dan Carpenter Oct. 23, 2020, 11:23 a.m. UTC
The typec_register_port() function doesn't return error pointers, it
returns error pointers.

Fixes: da0cb6310094 ("usb: typec: add support for STUSB160x Type-C controller family")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
 drivers/usb/typec/stusb160x.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Sergei Shtylyov Oct. 23, 2020, 1:56 p.m. UTC | #1
Hello!

On 10/23/20 2:23 PM, Dan Carpenter wrote:

> The typec_register_port() function doesn't return error pointers, it


   s/error/NULL/, maybe? :-)

> returns error pointers.

> 

> Fixes: da0cb6310094 ("usb: typec: add support for STUSB160x Type-C controller family")

> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

> ---

>  drivers/usb/typec/stusb160x.c | 4 ++--

>  1 file changed, 2 insertions(+), 2 deletions(-)

> 

> diff --git a/drivers/usb/typec/stusb160x.c b/drivers/usb/typec/stusb160x.c

> index ce0bd7b3ad88..f7369e371dd4 100644

> --- a/drivers/usb/typec/stusb160x.c

> +++ b/drivers/usb/typec/stusb160x.c

> @@ -729,8 +729,8 @@ static int stusb160x_probe(struct i2c_client *client)

>  	}

>  

>  	chip->port = typec_register_port(chip->dev, &chip->capability);

> -	if (!chip->port) {

> -		ret = -ENODEV;

> +	if (IS_ERR(chip->port)) {

> +		ret = PTR_ERR(chip->port);

>  		goto all_reg_disable;

>  	}

>  


MBR, Sergei
Heikki Krogerus Oct. 26, 2020, 10:50 a.m. UTC | #2
On Fri, Oct 23, 2020 at 02:23:47PM +0300, Dan Carpenter wrote:
> The typec_register_port() function doesn't return error pointers, it

> returns error pointers.

> 

> Fixes: da0cb6310094 ("usb: typec: add support for STUSB160x Type-C controller family")

> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>


You do need to fix the commit message like Sergei pointed out.
Otherwise, FWIW:

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


> ---

>  drivers/usb/typec/stusb160x.c | 4 ++--

>  1 file changed, 2 insertions(+), 2 deletions(-)

> 

> diff --git a/drivers/usb/typec/stusb160x.c b/drivers/usb/typec/stusb160x.c

> index ce0bd7b3ad88..f7369e371dd4 100644

> --- a/drivers/usb/typec/stusb160x.c

> +++ b/drivers/usb/typec/stusb160x.c

> @@ -729,8 +729,8 @@ static int stusb160x_probe(struct i2c_client *client)

>  	}

>  

>  	chip->port = typec_register_port(chip->dev, &chip->capability);

> -	if (!chip->port) {

> -		ret = -ENODEV;

> +	if (IS_ERR(chip->port)) {

> +		ret = PTR_ERR(chip->port);

>  		goto all_reg_disable;

>  	}

>  

> -- 

> 2.28.0


thanks,

-- 
heikki
diff mbox series

Patch

diff --git a/drivers/usb/typec/stusb160x.c b/drivers/usb/typec/stusb160x.c
index ce0bd7b3ad88..f7369e371dd4 100644
--- a/drivers/usb/typec/stusb160x.c
+++ b/drivers/usb/typec/stusb160x.c
@@ -729,8 +729,8 @@  static int stusb160x_probe(struct i2c_client *client)
 	}
 
 	chip->port = typec_register_port(chip->dev, &chip->capability);
-	if (!chip->port) {
-		ret = -ENODEV;
+	if (IS_ERR(chip->port)) {
+		ret = PTR_ERR(chip->port);
 		goto all_reg_disable;
 	}