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: 1864681 Return-Path: X-Original-To: patchwork-linux-fbdev@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork2.kernel.org (Postfix) with ESMTP id 4C5FCDF2EE for ; Wed, 12 Dec 2012 06:14:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751683Ab2LLGOG (ORCPT ); Wed, 12 Dec 2012 01:14:06 -0500 Received: from mail-pa0-f41.google.com ([209.85.220.41]:52876 "EHLO mail-pa0-f41.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750905Ab2LLGOD (ORCPT ); Wed, 12 Dec 2012 01:14:03 -0500 X-Greylist: delayed 2904 seconds by postgrey-1.27 at vger.kernel.org; Wed, 12 Dec 2012 01:14:03 EST Received: by mail-pa0-f41.google.com with SMTP id bj3so276466pad.0 for ; Tue, 11 Dec 2012 22:14:02 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=from:to:cc:subject:date:message-id:x-mailer:x-gm-message-state; bh=8CM3d9ZV4a8ihQM7tBChCIhC0lTb2Ot6peZUz37/EVs=; b=bYn+P6slFqrE3WVRslPuQK1Kk2a/RUBgdFegKuWAVrhhUgDrpj6nopjUxdBfId7Jml 3s0ySwEI3mfdjEtF8kFwpk+jN2JgYPuhi1bpi4MVMvoXuIJTK9GsLr6+dajp7OlyrZ0H huRS0c9VcZHImi6PJpVQJG8Ivahwd6L4t5PwxVrFkz9g9qwgnVSrUv+LUsg1F18Cbtgo FWn9MCOE8H4E10ukVpAk9rcYgMJ0ACdr1NUQY6SU7DiDm8GiJNeskK725XKIUpaVSCf8 RD3w8AcxevmuzTvzA8HKQqU/xvR6DmDYlmimCB6HqujANLj37nwFa7NvvOaZlLyR2z6B okeQ== 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: ALoCoQlddUpUw+fAFG0pXZdirnE5+kbkcR1Rxr18pgrx1AGtKvralngnOU4HmCp+h63SByGBQnOf Sender: linux-fbdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fbdev@vger.kernel.org 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; }