From patchwork Sat Jul 20 19:10:40 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Fabio Estevam X-Patchwork-Id: 2830846 Return-Path: X-Original-To: patchwork-linux-media@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 245689F4D4 for ; Sat, 20 Jul 2013 19:11:15 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 5022420150 for ; Sat, 20 Jul 2013 19:11:14 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 5BD352014C for ; Sat, 20 Jul 2013 19:11:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754778Ab3GTTKy (ORCPT ); Sat, 20 Jul 2013 15:10:54 -0400 Received: from mail-ye0-f170.google.com ([209.85.213.170]:60496 "EHLO mail-ye0-f170.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754484Ab3GTTKw (ORCPT ); Sat, 20 Jul 2013 15:10:52 -0400 Received: by mail-ye0-f170.google.com with SMTP id q3so1661106yen.29 for ; Sat, 20 Jul 2013 12:10:51 -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=pZW3s9u8iThNs1sjwQ2QJ/H+BYkHtAxIhKKbBhs51Z8=; b=AIgafMGDgOUcJOl06I53zp2ZAa4BZhOyB79RSqTQYRG7yKiFXZPxQs8eCInaCFH4vG lBmJYe+rie/p0q+zRer9AIjGnZsLgMYCeq4SgWtKabrnQKRqAfN+NV1U5fAJ6/upQE8v 6OjpNJgvxZ5VOleuhbnUgHvPtX2eTdUxKFeaC59DZY1CL6k9dGihR2X2+Uy28COR4Q64 KC1chMTXd4qr7THlyfIdtVSoUd07DNdsgDogSsE45E9go9syZotl3g6cahRrs99v0l2c CeqlUo+Kv3hyb3ryreB34nv1BSTzuw/KOlYUC10HALw4JPWulM63JzYfoPkMavIVp8R6 4Ytw== X-Received: by 10.236.153.233 with SMTP id f69mr11272884yhk.76.1374347451695; Sat, 20 Jul 2013 12:10:51 -0700 (PDT) Received: from localhost.localdomain ([189.5.19.145]) by mx.google.com with ESMTPSA id u25sm28524839yhl.23.2013.07.20.12.10.49 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Sat, 20 Jul 2013 12:10:51 -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 v2 1/2] [media] coda: Check the return value from clk_prepare_enable() Date: Sat, 20 Jul 2013 16:10:40 -0300 Message-Id: <1374347441-15662-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 --- Changes since v1: - Add missing 'if' drivers/media/platform/coda.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/drivers/media/platform/coda.c b/drivers/media/platform/coda.c index df4ada88..486db30 100644 --- a/drivers/media/platform/coda.c +++ b/drivers/media/platform/coda.c @@ -1559,14 +1559,21 @@ 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); + if (ret) + 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);