]> git.openfabrics.org - ~emulex/infiniband.git/commitdiff
drivers/video/exynos/s6e8ax0.c: use devm_* APIs in s6e8ax0.c
authorSachin Kamat <sachin.kamat@linaro.org>
Fri, 22 Feb 2013 00:42:25 +0000 (16:42 -0800)
committerLinus Torvalds <torvalds@linux-foundation.org>
Fri, 22 Feb 2013 01:22:18 +0000 (17:22 -0800)
devm_* APIs are device managed and make error handling and code cleanup
simpler.

Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Acked-by: Donghwa Lee <dh09.lee@samsung.com>
Cc: Inki Dae <inki.dae@samsung.com>
Cc: Florian Tobias Schandinat <FlorianSchandinat@gmx.de>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
drivers/video/exynos/s6e8ax0.c

index 05d080b63bc0b85276c4ff999d93dd9ba1b76982..ca2602413aa43a0b0dcda6a47ce4e6e57fc574e7 100644 (file)
@@ -776,7 +776,7 @@ static int s6e8ax0_probe(struct mipi_dsim_lcd_device *dsim_dev)
        int ret;
        u8 mtp_id[3] = {0, };
 
-       lcd = kzalloc(sizeof(struct s6e8ax0), GFP_KERNEL);
+       lcd = devm_kzalloc(&dsim_dev->dev, sizeof(struct s6e8ax0), GFP_KERNEL);
        if (!lcd) {
                dev_err(&dsim_dev->dev, "failed to allocate s6e8ax0 structure.\n");
                return -ENOMEM;
@@ -788,18 +788,17 @@ static int s6e8ax0_probe(struct mipi_dsim_lcd_device *dsim_dev)
 
        mutex_init(&lcd->lock);
 
-       ret = regulator_bulk_get(lcd->dev, ARRAY_SIZE(supplies), supplies);
+       ret = devm_regulator_bulk_get(lcd->dev, ARRAY_SIZE(supplies), supplies);
        if (ret) {
                dev_err(lcd->dev, "Failed to get regulators: %d\n", ret);
-               goto err_lcd_register;
+               return ret;
        }
 
        lcd->ld = lcd_device_register("s6e8ax0", lcd->dev, lcd,
                        &s6e8ax0_lcd_ops);
        if (IS_ERR(lcd->ld)) {
                dev_err(lcd->dev, "failed to register lcd ops.\n");
-               ret = PTR_ERR(lcd->ld);
-               goto err_lcd_register;
+               return PTR_ERR(lcd->ld);
        }
 
        lcd->bd = backlight_device_register("s6e8ax0-bl", lcd->dev, lcd,
@@ -838,11 +837,6 @@ static int s6e8ax0_probe(struct mipi_dsim_lcd_device *dsim_dev)
 
 err_backlight_register:
        lcd_device_unregister(lcd->ld);
-
-err_lcd_register:
-       regulator_bulk_free(ARRAY_SIZE(supplies), supplies);
-       kfree(lcd);
-
        return ret;
 }