Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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 <clement.perrochaud@nxp.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>

authored by

Clement Perrochaud and committed by
Samuel Ortiz
12b25dbf 742b1f9f

+5 -1
+5 -1
drivers/nfc/pn544/i2c.c
··· 1029 1029 free_irq(client->irq, phy); 1030 1030 1031 1031 err_rti: 1032 - if (pdata->free_resources != NULL) 1032 + if (!pdata) { 1033 + gpio_free(phy->gpio_en); 1034 + gpio_free(phy->gpio_fw); 1035 + } else if (pdata->free_resources) { 1033 1036 pdata->free_resources(); 1037 + } 1034 1038 1035 1039 return r; 1036 1040 }