aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/leds/leds-sunfire.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/drivers/leds/leds-sunfire.c b/drivers/leds/leds-sunfire.c
index ab6d18f5c39f..1757396b20b3 100644
--- a/drivers/leds/leds-sunfire.c
+++ b/drivers/leds/leds-sunfire.c
@@ -127,17 +127,19 @@ static int __devinit sunfire_led_generic_probe(struct platform_device *pdev,
127 struct led_type *types) 127 struct led_type *types)
128{ 128{
129 struct sunfire_drvdata *p; 129 struct sunfire_drvdata *p;
130 int i, err = -EINVAL; 130 int i, err;
131 131
132 if (pdev->num_resources != 1) { 132 if (pdev->num_resources != 1) {
133 printk(KERN_ERR PFX "Wrong number of resources %d, should be 1\n", 133 printk(KERN_ERR PFX "Wrong number of resources %d, should be 1\n",
134 pdev->num_resources); 134 pdev->num_resources);
135 err = -EINVAL;
135 goto out; 136 goto out;
136 } 137 }
137 138
138 p = kzalloc(sizeof(*p), GFP_KERNEL); 139 p = kzalloc(sizeof(*p), GFP_KERNEL);
139 if (!p) { 140 if (!p) {
140 printk(KERN_ERR PFX "Could not allocate struct sunfire_drvdata\n"); 141 printk(KERN_ERR PFX "Could not allocate struct sunfire_drvdata\n");
142 err = -ENOMEM;
141 goto out; 143 goto out;
142 } 144 }
143 145
@@ -160,14 +162,14 @@ static int __devinit sunfire_led_generic_probe(struct platform_device *pdev,
160 162
161 dev_set_drvdata(&pdev->dev, p); 163 dev_set_drvdata(&pdev->dev, p);
162 164
163 err = 0; 165 return 0;
164out:
165 return err;
166 166
167out_unregister_led_cdevs: 167out_unregister_led_cdevs:
168 for (i--; i >= 0; i--) 168 for (i--; i >= 0; i--)
169 led_classdev_unregister(&p->leds[i].led_cdev); 169 led_classdev_unregister(&p->leds[i].led_cdev);
170 goto out; 170 kfree(p);
171out:
172 return err;
171} 173}
172 174
173static int __devexit sunfire_led_generic_remove(struct platform_device *pdev) 175static int __devexit sunfire_led_generic_remove(struct platform_device *pdev)