From patchwork Fri Nov 23 11:50:39 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sachin Kamat X-Patchwork-Id: 1795121 Return-Path: X-Original-To: patchwork-linux-media@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork1.kernel.org (Postfix) with ESMTP id 73B153FC64 for ; Fri, 23 Nov 2012 11:57:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754781Ab2KWL5H (ORCPT ); Fri, 23 Nov 2012 06:57:07 -0500 Received: from mail-pa0-f46.google.com ([209.85.220.46]:64565 "EHLO mail-pa0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754105Ab2KWL5G (ORCPT ); Fri, 23 Nov 2012 06:57:06 -0500 Received: by mail-pa0-f46.google.com with SMTP id bh2so3502852pad.19 for ; Fri, 23 Nov 2012 03:57:05 -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:in-reply-to:references :x-gm-message-state; bh=3yWBgUlBKOW8ndzHEnf5nLwc1DRRUd5vBBkVc6G2mRU=; b=pzCkqZdbJ6bkhIMmR8Rpy7lswfcKB98jSVSgiAKsJSIU2CirkrPHsFfomf1+dQcDsK oXqWG4xib8BuVhZAv3SEbkLvaIvHfMLnpqMFP2BVGGtje/p7Q1UcOUBgI+eHTnXHFans pli18ezgKIFz6Ug8jRRM8YTzuSinpX6OQ70kRi6T8qCBPTgtAnQLN559zIoSHAWwj5W0 psRqnvSijoNBQvHISFy7mqkZj4+axSJr7c/ghqCWXovB67Agoo0xON+nu0oFoRm7X3sH uwiT4W38DyjzAsCm7l5V2zXS94Hq10hOhhN/74HveDZZN+b3Y9tkaFbOM2JZI7Sixr1e JZ8w== Received: by 10.68.196.170 with SMTP id in10mr13948131pbc.0.1353671825834; Fri, 23 Nov 2012 03:57:05 -0800 (PST) Received: from localhost.localdomain ([115.113.119.130]) by mx.google.com with ESMTPS id zv10sm3718784pbc.76.2012.11.23.03.57.03 (version=TLSv1/SSLv3 cipher=OTHER); Fri, 23 Nov 2012 03:57:05 -0800 (PST) From: Sachin Kamat To: linux-media@vger.kernel.org Cc: s.nawrocki@samsung.com, sachin.kamat@linaro.org, patches@linaro.org Subject: [PATCH 2/6] [media] s5p-fimc: Use devm_clk_get in fimc-core.c Date: Fri, 23 Nov 2012 17:20:39 +0530 Message-Id: <1353671443-2978-3-git-send-email-sachin.kamat@linaro.org> X-Mailer: git-send-email 1.7.4.1 In-Reply-To: <1353671443-2978-1-git-send-email-sachin.kamat@linaro.org> References: <1353671443-2978-1-git-send-email-sachin.kamat@linaro.org> X-Gm-Message-State: ALoCoQl40GKpaDCf76jO/erCRwT6K3FW/ljk0k5dlOQiFqHFdTRnlrGAQvInCI1YFAhK5xEHa9Lk Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org devm_clk_get is device managed and makes error handling and cleanup a bit simpler. Signed-off-by: Sachin Kamat --- drivers/media/platform/s5p-fimc/fimc-core.c | 10 ++-------- 1 files changed, 2 insertions(+), 8 deletions(-) diff --git a/drivers/media/platform/s5p-fimc/fimc-core.c b/drivers/media/platform/s5p-fimc/fimc-core.c index 8d0d2b9..0c45127 100644 --- a/drivers/media/platform/s5p-fimc/fimc-core.c +++ b/drivers/media/platform/s5p-fimc/fimc-core.c @@ -814,8 +814,6 @@ static void fimc_clk_put(struct fimc_dev *fimc) if (IS_ERR_OR_NULL(fimc->clock[i])) continue; clk_unprepare(fimc->clock[i]); - clk_put(fimc->clock[i]); - fimc->clock[i] = NULL; } } @@ -824,19 +822,15 @@ static int fimc_clk_get(struct fimc_dev *fimc) int i, ret; for (i = 0; i < MAX_FIMC_CLOCKS; i++) { - fimc->clock[i] = clk_get(&fimc->pdev->dev, fimc_clocks[i]); + fimc->clock[i] = devm_clk_get(&fimc->pdev->dev, fimc_clocks[i]); if (IS_ERR(fimc->clock[i])) goto err; ret = clk_prepare(fimc->clock[i]); - if (ret < 0) { - clk_put(fimc->clock[i]); - fimc->clock[i] = NULL; + if (ret < 0) goto err; - } } return 0; err: - fimc_clk_put(fimc); dev_err(&fimc->pdev->dev, "failed to get clock: %s\n", fimc_clocks[i]); return -ENXIO;