diff mbox

[v8,08/14] staging: typec: tcpci: use IS_ERR() instead of PTR_ERR_OR_ZERO()

Message ID 1530056732-9640-9-git-send-email-jun.li@nxp.com (mailing list archive)
State New, archived
Headers show

Commit Message

Jun Li June 26, 2018, 11:45 p.m. UTC
As tcpm_register_port() and tcpci_register_port() never return
NULL and NULL is not a success in this case, use IS_ERR() to check
the return value of both.

Reviewed-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Signed-off-by: Li Jun <jun.li@nxp.com>
---
 drivers/staging/typec/tcpci.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Guenter Roeck June 27, 2018, 12:32 a.m. UTC | #1
On 06/26/2018 04:45 PM, Li Jun wrote:
> As tcpm_register_port() and tcpci_register_port() never return
> NULL and NULL is not a success in this case, use IS_ERR() to check
> the return value of both.
> 
> Reviewed-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
> Signed-off-by: Li Jun <jun.li@nxp.com>

Reviewed-by: Guenter Roeck <linux@roeck-us.net>

> ---
>   drivers/staging/typec/tcpci.c | 4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/staging/typec/tcpci.c b/drivers/staging/typec/tcpci.c
> index 076498a..b63f147 100644
> --- a/drivers/staging/typec/tcpci.c
> +++ b/drivers/staging/typec/tcpci.c
> @@ -509,7 +509,7 @@ struct tcpci *tcpci_register_port(struct device *dev, struct tcpci_data *data)
>   		return ERR_PTR(err);
>   
>   	tcpci->port = tcpm_register_port(tcpci->dev, &tcpci->tcpc);
> -	if (PTR_ERR_OR_ZERO(tcpci->port))
> +	if (IS_ERR(tcpci->port))
>   		return ERR_CAST(tcpci->port);
>   
>   	return tcpci;
> @@ -551,7 +551,7 @@ static int tcpci_probe(struct i2c_client *client,
>   		return err;
>   
>   	chip->tcpci = tcpci_register_port(&client->dev, &chip->data);
> -	if (PTR_ERR_OR_ZERO(chip->tcpci))
> +	if (IS_ERR(chip->tcpci))
>   		return PTR_ERR(chip->tcpci);
>   
>   	i2c_set_clientdata(client, chip);
> 

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/drivers/staging/typec/tcpci.c b/drivers/staging/typec/tcpci.c
index 076498a..b63f147 100644
--- a/drivers/staging/typec/tcpci.c
+++ b/drivers/staging/typec/tcpci.c
@@ -509,7 +509,7 @@  struct tcpci *tcpci_register_port(struct device *dev, struct tcpci_data *data)
 		return ERR_PTR(err);
 
 	tcpci->port = tcpm_register_port(tcpci->dev, &tcpci->tcpc);
-	if (PTR_ERR_OR_ZERO(tcpci->port))
+	if (IS_ERR(tcpci->port))
 		return ERR_CAST(tcpci->port);
 
 	return tcpci;
@@ -551,7 +551,7 @@  static int tcpci_probe(struct i2c_client *client,
 		return err;
 
 	chip->tcpci = tcpci_register_port(&client->dev, &chip->data);
-	if (PTR_ERR_OR_ZERO(chip->tcpci))
+	if (IS_ERR(chip->tcpci))
 		return PTR_ERR(chip->tcpci);
 
 	i2c_set_clientdata(client, chip);