Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 351910
b: refs/heads/master
c: a0f3653
h: refs/heads/master
v: v3
  • Loading branch information
Samuel Ortiz committed Jan 9, 2013
1 parent d2ce812 commit bb91a55
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 15 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 234d4d6b1038f004f233f14906ec9328bf53088b
refs/heads/master: a0f36536ac2ec0f7a9cfb53c72d6d8c378815fdb
20 changes: 6 additions & 14 deletions trunk/drivers/nfc/pn544/i2c.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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);
Expand Down Expand Up @@ -435,10 +433,6 @@ static int __devinit pn544_hci_i2c_probe(struct i2c_client *client,
if (pdata->free_resources != NULL)
pdata->free_resources();

err_pdata:
kfree(phy);

err_phy_alloc:
return r;
}

Expand All @@ -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;
}

Expand Down

0 comments on commit bb91a55

Please sign in to comment.