summaryrefslogtreecommitdiffstats
path: root/drivers/nfc/pn544
diff options
context:
space:
mode:
authorSamuel Ortiz <sameo@linux.intel.com>2012-12-18 18:07:37 +0100
committerSamuel Ortiz <sameo@linux.intel.com>2013-01-10 00:51:53 +0100
commita0f36536ac2ec0f7a9cfb53c72d6d8c378815fdb (patch)
tree55e068c7bc4aed729898965836add0f9cd0867eb /drivers/nfc/pn544
parent234d4d6b1038f004f233f14906ec9328bf53088b (diff)
downloadlinux-a0f36536ac2ec0f7a9cfb53c72d6d8c378815fdb.tar.bz2
NFC: pn544: Use devm_kzalloc API
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
Diffstat (limited to 'drivers/nfc/pn544')
-rw-r--r--drivers/nfc/pn544/i2c.c20
1 files changed, 6 insertions, 14 deletions
diff --git a/drivers/nfc/pn544/i2c.c b/drivers/nfc/pn544/i2c.c
index ec79f355edc1..7f96ca2c46bd 100644
--- a/drivers/nfc/pn544/i2c.c
+++ b/drivers/nfc/pn544/i2c.c
@@ -376,12 +376,12 @@ static int __devinit pn544_hci_i2c_probe(struct i2c_client *client,
return -ENODEV;
}
- phy = kzalloc(sizeof(struct pn544_i2c_phy), GFP_KERNEL);
+ phy = devm_kzalloc(&client->dev, sizeof(struct pn544_i2c_phy),
+ GFP_KERNEL);
if (!phy) {
dev_err(&client->dev,
"Cannot allocate memory for pn544 i2c phy.\n");
- r = -ENOMEM;
- goto err_phy_alloc;
+ return -ENOMEM;
}
phy->i2c_dev = client;
@@ -390,20 +390,18 @@ static int __devinit pn544_hci_i2c_probe(struct i2c_client *client,
pdata = client->dev.platform_data;
if (pdata == NULL) {
dev_err(&client->dev, "No platform data\n");
- r = -EINVAL;
- goto err_pdata;
+ return -EINVAL;
}
if (pdata->request_resources == NULL) {
dev_err(&client->dev, "request_resources() missing\n");
- r = -EINVAL;
- goto err_pdata;
+ return -EINVAL;
}
r = pdata->request_resources(client);
if (r) {
dev_err(&client->dev, "Cannot get platform resources\n");
- goto err_pdata;
+ return r;
}
phy->gpio_en = pdata->get_gpio(NFC_GPIO_ENABLE);
@@ -435,10 +433,6 @@ err_rti:
if (pdata->free_resources != NULL)
pdata->free_resources();
-err_pdata:
- kfree(phy);
-
-err_phy_alloc:
return r;
}
@@ -458,8 +452,6 @@ static __devexit int pn544_hci_i2c_remove(struct i2c_client *client)
if (pdata->free_resources)
pdata->free_resources();
- kfree(phy);
-
return 0;
}