From patchwork Wed Dec 12 05:11:23 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sachin Kamat X-Patchwork-Id: 13487 Return-Path: X-Original-To: patchwork@peony.canonical.com Delivered-To: patchwork@peony.canonical.com Received: from fiordland.canonical.com (fiordland.canonical.com [91.189.94.145]) by peony.canonical.com (Postfix) with ESMTP id 4AB532425B for ; Wed, 12 Dec 2012 06:25:07 +0000 (UTC) Received: from mail-ia0-f169.google.com (mail-ia0-f169.google.com [209.85.210.169]) by fiordland.canonical.com (Postfix) with ESMTP id E45EDA18EB7 for ; Wed, 12 Dec 2012 06:25:06 +0000 (UTC) Received: by mail-ia0-f169.google.com with SMTP id r4so599760iaj.14 for ; Tue, 11 Dec 2012 22:25:06 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-forwarded-to:x-forwarded-for:delivered-to:received-spf:from:to:cc :subject:date:message-id:x-mailer:x-gm-message-state; bh=8CM3d9ZV4a8ihQM7tBChCIhC0lTb2Ot6peZUz37/EVs=; b=bb4+ix/641QOIlHZBSt6VopQgITbT+++V7RxhRDrpnD5xZPL/1HyoKvfhvJ4L7AP0u gB4DPmjtKvkHOJ7matnHqma/2BatDZnrPtvCK/snKGZKqIuFXrxN/yzmB/H02g2nRtDJ fPs3NjNa343bh9YnWGAOTtJlGpCT/pbBw28F9cZe4rcAl6ltg8xX/FBY79ep/ZXRTMlR do3YVgozvlA0oqone79g7JPHs8FRH39AYZdCMK7YH+N++mxjet6PMZvYsESaaQqy4n3f z2cubFm9l+QHTrKIDFr/JE4VSQ4WK0YFHH0JbzHExW1Y8utDL/GHvmaYsJ50bXe/FR3N +VDg== Received: by 10.43.49.199 with SMTP id vb7mr449256icb.6.1355289511581; Tue, 11 Dec 2012 21:18:31 -0800 (PST) X-Forwarded-To: linaro-patchwork@canonical.com X-Forwarded-For: patch@linaro.org linaro-patchwork@canonical.com Delivered-To: patches@linaro.org Received: by 10.50.67.148 with SMTP id n20csp178250igt; Tue, 11 Dec 2012 21:18:31 -0800 (PST) Received: by 10.68.135.99 with SMTP id pr3mr1788026pbb.151.1355289510580; Tue, 11 Dec 2012 21:18:30 -0800 (PST) Received: from mail-pb0-f54.google.com (mail-pb0-f54.google.com [209.85.160.54]) by mx.google.com with ESMTPS id zs6si8955998pbc.31.2012.12.11.21.18.30 (version=TLSv1/SSLv3 cipher=OTHER); Tue, 11 Dec 2012 21:18:30 -0800 (PST) Received-SPF: neutral (google.com: 209.85.160.54 is neither permitted nor denied by best guess record for domain of sachin.kamat@linaro.org) client-ip=209.85.160.54; Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.160.54 is neither permitted nor denied by best guess record for domain of sachin.kamat@linaro.org) smtp.mail=sachin.kamat@linaro.org Received: by mail-pb0-f54.google.com with SMTP id wz12so207876pbc.41 for ; Tue, 11 Dec 2012 21:18:30 -0800 (PST) Received: by 10.68.213.202 with SMTP id nu10mr1981899pbc.91.1355289510114; Tue, 11 Dec 2012 21:18:30 -0800 (PST) Received: from localhost.localdomain ([115.113.119.130]) by mx.google.com with ESMTPS id hs2sm14999511pbc.22.2012.12.11.21.18.26 (version=TLSv1/SSLv3 cipher=OTHER); Tue, 11 Dec 2012 21:18:29 -0800 (PST) From: Sachin Kamat To: linux-fbdev@vger.kernel.org Cc: akpm@linux-foundation.org, FlorianSchandinat@gmx.de, sachin.kamat@linaro.org, patches@linaro.org, Donghwa Lee , Inki Dae Subject: [PATCH 1/1] video: exynos: Use devm_* APIs in s6e8ax0.c Date: Wed, 12 Dec 2012 10:41:23 +0530 Message-Id: <1355289083-28269-1-git-send-email-sachin.kamat@linaro.org> X-Mailer: git-send-email 1.7.4.1 X-Gm-Message-State: ALoCoQm0YqhpBmti5NpVsOjwj3uuxtwNocpi3EsZQiAFsBYkNEZo1Ij/hSfImmras2Mxe6XyhO93 devm_* APIs are device managed and make error handling and code cleanup simpler. Cc: Donghwa Lee Cc: Inki Dae Signed-off-by: Sachin Kamat Acked-by: Donghwa Lee --- Compile tested against linux-next. --- drivers/video/exynos/s6e8ax0.c | 14 ++++---------- 1 files changed, 4 insertions(+), 10 deletions(-) diff --git a/drivers/video/exynos/s6e8ax0.c b/drivers/video/exynos/s6e8ax0.c index 05d080b..ca26024 100644 --- a/drivers/video/exynos/s6e8ax0.c +++ b/drivers/video/exynos/s6e8ax0.c @@ -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; }