[PATCH v12 10/10] usb: typec: tcpci_maxim: Fix uninitialized return variable

From: Badhri Jagan Sridharan
Date: Thu Oct 29 2020 - 03:38:14 EST


New smatch warnings:
drivers/usb/typec/tcpm/tcpci_maxim.c:324 max_tcpci_irq() error: uninitialized symbol 'irq_return'.
drivers/usb/typec/tcpm/tcpci_maxim.c:407 max_tcpci_probe() warn: passing zero to 'PTR_ERR'

The change fixes the above warnings by initializing irq_return
and replacing IS_ERR_OR_NULL with IS_ERR.

Reported-by: kernel test robot <lkp@xxxxxxxxx>
Reported-by: Dan Carpenter <dan.carpenter@xxxxxxxxxx>
Signed-off-by: Badhri Jagan Sridharan <badhri@xxxxxxxxxx>
---
v12 is the first version of the patch in this series.
---
drivers/usb/typec/tcpm/tcpci_maxim.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/usb/typec/tcpm/tcpci_maxim.c b/drivers/usb/typec/tcpm/tcpci_maxim.c
index 536df4a7901a..c1797239bf08 100644
--- a/drivers/usb/typec/tcpm/tcpci_maxim.c
+++ b/drivers/usb/typec/tcpm/tcpci_maxim.c
@@ -343,7 +343,7 @@ static irqreturn_t max_tcpci_irq(int irq, void *dev_id)
{
struct max_tcpci_chip *chip = dev_id;
u16 status;
- irqreturn_t irq_return;
+ irqreturn_t irq_return = IRQ_HANDLED;
int ret;

if (!chip->port)
@@ -445,7 +445,7 @@ static int max_tcpci_probe(struct i2c_client *client, const struct i2c_device_id

max_tcpci_init_regs(chip);
chip->tcpci = tcpci_register_port(chip->dev, &chip->data);
- if (IS_ERR_OR_NULL(chip->tcpci)) {
+ if (IS_ERR(chip->tcpci)) {
dev_err(&client->dev, "TCPCI port registration failed");
ret = PTR_ERR(chip->tcpci);
return PTR_ERR(chip->tcpci);
--
2.29.1.341.ge80a0c044ae-goog