summaryrefslogtreecommitdiff
path: root/drivers/nfc/fdp
diff options
context:
space:
mode:
authorSudip Mukherjee <sudipm.mukherjee@gmail.com>2016-12-20 21:09:04 +0000
committerSamuel Ortiz <sameo@linux.intel.com>2017-04-02 00:36:12 +0200
commitb6355fb3f5f40bbce165847d277e64896cab8f95 (patch)
tree6cc32a24790fb4f29418cd83a2e1f11702b6485a /drivers/nfc/fdp
parentce69b95ca4e459f54b5afad717d2129d3ba1ff6e (diff)
nfc: fdp: fix NULL pointer dereference
We are checking phy after dereferencing it. We can print the debug information after checking it. If phy is NULL then we will get a good stack trace to tell us that we are in this irq handler. Signed-off-by: Sudip Mukherjee <sudip.mukherjee@codethink.co.uk> Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
Diffstat (limited to 'drivers/nfc/fdp')
-rw-r--r--drivers/nfc/fdp/i2c.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/drivers/nfc/fdp/i2c.c b/drivers/nfc/fdp/i2c.c
index 5e797d5c38ed..712936f5d2d6 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)