Dan Carpenter reported the following:

"The patch a06347c04c13: "NFC: Add Intel Fields Peak NFC solution
driver" from Oct 22, 2015, leads to the following Smatch complaint:

drivers/nfc/fdp/i2c.c:216 fdp_nci_i2c_irq_thread_fn()
         warn: variable dereferenced before check 'phy' (see line 213)

drivers/nfc/fdp/i2c.c
   212
   213          client = phy->i2c_dev;
                         ^^^^^
Dereference.

   214          dev_dbg(&client->dev, "%s\n", __func__);
   215
   216          if (!phy || irq != phy->i2c_dev->irq) {
                    ^^^^
Check.

   217                  WARN_ON_ONCE(1);
   218                  return IRQ_NONE;
"

Reported-by: Dan Carpenter <[email protected]>
Signed-off-by: Fabio Estevam <[email protected]>
---
 drivers/nfc/fdp/i2c.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/nfc/fdp/i2c.c b/drivers/nfc/fdp/i2c.c
index 532db28..a5d7332 100644
--- a/drivers/nfc/fdp/i2c.c
+++ b/drivers/nfc/fdp/i2c.c
@@ -210,14 +210,14 @@ static irqreturn_t fdp_nci_i2c_irq_thread_fn(int irq, 
void *phy_id)
        struct sk_buff *skb;
        int r;
 
-       client = phy->i2c_dev;
-       dev_dbg(&client->dev, "%s\n", __func__);
-
        if (!phy || irq != phy->i2c_dev->irq) {
                WARN_ON_ONCE(1);
                return IRQ_NONE;
        }
 
+       client = phy->i2c_dev;
+       dev_dbg(&client->dev, "%s\n", __func__);
+
        r = fdp_nci_i2c_read(phy, &skb);
 
        if (r == -EREMOTEIO)
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to