From b9c6f782150c9992308f4474f920586eaaca4cf1 Mon Sep 17 00:00:00 2001 From: Dan Carpenter Date: Fri, 23 Oct 2020 14:40:17 +0300 Subject: [PATCH] usb: typec: stusb160x: fix an IS_ERR() vs NULL check in probe The typec_register_port() function doesn't return NULL, it returns error pointers. Fixes: da0cb6310094 ("usb: typec: add support for STUSB160x Type-C controller family") Signed-off-by: Dan Carpenter Reviewed-by: Heikki Krogerus Link: https://lore.kernel.org/r/20201023114017.GE18329@kadam Signed-off-by: Greg Kroah-Hartman --- 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 7143852ce94d..da7f1957bcb3 100644 --- a/drivers/usb/typec/stusb160x.c +++ b/drivers/usb/typec/stusb160x.c @@ -730,8 +730,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; }