From: Clement Perrochaud Date: Tue, 8 Apr 2014 11:13:49 +0000 (+0000) Subject: NFC: pn544_i2c: Fix null pointer exception when not using platform data X-Git-Tag: next-20140530~73^2~60^2~23 X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=12b25dbf119337ce51dc93e5ecd7cbe891877328;p=karo-tx-linux.git NFC: pn544_i2c: Fix null pointer exception when not using platform data Fixes a null pointer exception occurring when the IRQ request in pn544_hci_i2c_probe fails and no platform data is available. Signed-off-by: Clément Perrochaud Signed-off-by: Samuel Ortiz --- diff --git a/drivers/nfc/pn544/i2c.c b/drivers/nfc/pn544/i2c.c index 5239e3b54120..440291ab7263 100644 --- a/drivers/nfc/pn544/i2c.c +++ b/drivers/nfc/pn544/i2c.c @@ -1029,8 +1029,12 @@ err_hci: free_irq(client->irq, phy); err_rti: - if (pdata->free_resources != NULL) + if (!pdata) { + gpio_free(phy->gpio_en); + gpio_free(phy->gpio_fw); + } else if (pdata->free_resources) { pdata->free_resources(); + } return r; }