From patchwork Sat Jul 20 18:48:48 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Fabio Estevam X-Patchwork-Id: 2830844 Return-Path: X-Original-To: patchwork-linux-media@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id BA8C9C0319 for ; Sat, 20 Jul 2013 18:49:15 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id CF88520150 for ; Sat, 20 Jul 2013 18:49:14 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id DD3B92012E for ; Sat, 20 Jul 2013 18:49:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754739Ab3GTStI (ORCPT ); Sat, 20 Jul 2013 14:49:08 -0400 Received: from mail-ye0-f174.google.com ([209.85.213.174]:36342 "EHLO mail-ye0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754723Ab3GTStH (ORCPT ); Sat, 20 Jul 2013 14:49:07 -0400 Received: by mail-ye0-f174.google.com with SMTP id m9so1639525yen.33 for ; Sat, 20 Jul 2013 11:49:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:x-mailer; bh=92wtv0mtTveHIKcPmIMiBy5l+PKQIaRPBsRMtEq/srg=; b=WYuMtYZY/t1geRh+D7v4VxgNsZTEw+00fCCA9bbckABWGrZO4rzpP9NxYl9rGURDpv S2/pdmAdZuOZVU8AUAWQUpVxGo0qkS1UgglCRwFrLUFypGvQwpWeEBoudDZaF8zX+Bfo x3oanIlkDkj+9wrv41z/E4PKUJzLeO+5+gNc+BwkdDtzkGpq2WSznfkla8vscMGHXgKF 8yjUZ9yTt1D2OrrN1wNJ4Y6FVaKQpsRNoVxeu9JpRQUCHTqTTwMB3kJncr8/PSsqBNu4 wHt7DUxvbzUy+j6ikDq9Ri+FHarZ1KSMSsdhA6dfEljwAOwxZapYDBqVcPBmG6WBGWrH L64A== X-Received: by 10.236.104.162 with SMTP id i22mr11226819yhg.193.1374346146891; Sat, 20 Jul 2013 11:49:06 -0700 (PDT) Received: from localhost.localdomain ([189.5.19.145]) by mx.google.com with ESMTPSA id v68sm29205765yhn.22.2013.07.20.11.49.05 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Sat, 20 Jul 2013 11:49:06 -0700 (PDT) From: Fabio Estevam To: k.debski@samsung.com Cc: m.chehab@samsung.com, kernel@pengutronix.de, linux-media@vger.kernel.org, Fabio Estevam Subject: [PATCH 1/2] [media] coda: Check the return value from clk_prepare_enable() Date: Sat, 20 Jul 2013 15:48:48 -0300 Message-Id: <1374346129-12907-1-git-send-email-festevam@gmail.com> X-Mailer: git-send-email 1.8.1.2 Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-Spam-Status: No, score=-7.2 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Fabio Estevam clk_prepare_enable() may fail, so let's check its return value and propagate it in the case of error. Signed-off-by: Fabio Estevam --- drivers/media/platform/coda.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/drivers/media/platform/coda.c b/drivers/media/platform/coda.c index df4ada88..dd76228 100644 --- a/drivers/media/platform/coda.c +++ b/drivers/media/platform/coda.c @@ -1559,14 +1559,20 @@ static int coda_open(struct file *file) list_add(&ctx->list, &dev->instances); coda_unlock(ctx); - clk_prepare_enable(dev->clk_per); - clk_prepare_enable(dev->clk_ahb); + ret = clk_prepare_enable(dev->clk_per); + if (ret) + goto err; + + ret = clk_prepare_enable(dev->clk_ahb); + goto err_clk_ahb; v4l2_dbg(1, coda_debug, &dev->v4l2_dev, "Created instance %d (%p)\n", ctx->idx, ctx); return 0; +err_clk_ahb: + clk_disable_unprepare(dev->clk_per); err: v4l2_fh_del(&ctx->fh); v4l2_fh_exit(&ctx->fh);