aboutsummaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorPaul Fertser <fercerpav@gmail.com>2009-10-17 05:00:52 +0400
committerPaul Fertser <fercerpav@gmail.com>2009-10-17 05:00:52 +0400
commit3cc444df2d19d0166e544ae01c0c79fd4a806646 (patch)
treef4caacfe46e93449aa5f6df59dff625fc6659072 /drivers
parent350d5560bb262e73e1f1c05bf488fea6750a52d6 (diff)
Cleanup pcf50606_probe error handling
Ported from f9745d7f9cca30230a827f2170cf038a368f9992
Diffstat (limited to 'drivers')
-rw-r--r--drivers/mfd/pcf50606-core.c36
1 files changed, 18 insertions, 18 deletions
diff --git a/drivers/mfd/pcf50606-core.c b/drivers/mfd/pcf50606-core.c
index a6ff522931d..8aad6af951a 100644
--- a/drivers/mfd/pcf50606-core.c
+++ b/drivers/mfd/pcf50606-core.c
@@ -530,9 +530,14 @@ static int pcf50606_probe(struct i2c_client *client,
{
struct pcf50606 *pcf;
struct pcf50606_platform_data *pdata = client->dev.platform_data;
- int i, ret = 0;
+ int i, ret;
int version, variant;
+ if (!client->irq) {
+ dev_err(&client->dev, "Missing IRQ\n");
+ return -ENOENT;
+ }
+
pcf = kzalloc(sizeof(*pcf), GFP_KERNEL);
if (!pcf)
return -ENOMEM;
@@ -564,6 +569,14 @@ static int pcf50606_probe(struct i2c_client *client,
pcf50606_reg_write(pcf, PCF50606_REG_INT2M, 0x00);
pcf50606_reg_write(pcf, PCF50606_REG_INT3M, 0x00);
+ ret = request_irq(client->irq, pcf50606_irq,
+ IRQF_TRIGGER_LOW, "pcf50606", pcf);
+
+ if (ret) {
+ dev_err(pcf->dev, "Failed to request IRQ %d\n", ret);
+ goto err;
+ }
+
pcf50606_client_dev_register(pcf, "pcf50606-input",
&pcf->input_pdev);
pcf50606_client_dev_register(pcf, "pcf50606-rtc",
@@ -579,7 +592,7 @@ static int pcf50606_probe(struct i2c_client *client,
pdev = platform_device_alloc("pcf50606-regltr", i);
if (!pdev) {
- dev_err(pcf->dev, "Cannot create regulator\n");
+ dev_err(pcf->dev, "Cannot create regulator %d\n", i);
continue;
}
@@ -591,27 +604,13 @@ static int pcf50606_probe(struct i2c_client *client,
platform_device_add(pdev);
}
- if (client->irq) {
- set_irq_handler(client->irq, handle_level_irq);
- ret = request_irq(client->irq, pcf50606_irq,
- IRQF_TRIGGER_LOW, "pcf50606", pcf);
-
- if (ret) {
- dev_err(pcf->dev, "Failed to request IRQ %d\n", ret);
- goto err;
- }
- } else {
- dev_err(pcf->dev, "No IRQ configured\n");
- goto err;
- }
-
if (enable_irq_wake(client->irq) < 0)
- dev_err(pcf->dev, "IRQ %u cannot be enabled as wake-up source"
+ dev_info(pcf->dev, "IRQ %u cannot be enabled as wake-up source"
"in this hardware revision", client->irq);
ret = sysfs_create_group(&client->dev.kobj, &pcf_attr_group);
if (ret)
- dev_err(pcf->dev, "error creating sysfs entries\n");
+ dev_info(pcf->dev, "error creating sysfs entries\n");
if (pdata->probe_done)
pdata->probe_done(pcf);
@@ -619,6 +618,7 @@ static int pcf50606_probe(struct i2c_client *client,
return 0;
err:
+ i2c_set_clientdata(client, NULL);
kfree(pcf);
return ret;
}