From patchwork Wed Dec 4 22:21:37 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Fabio Estevam X-Patchwork-Id: 296643 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 95D9F2C00A9 for ; Thu, 5 Dec 2013 09:22:14 +1100 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756105Ab3LDWWN (ORCPT ); Wed, 4 Dec 2013 17:22:13 -0500 Received: from mail-qa0-f42.google.com ([209.85.216.42]:51513 "EHLO mail-qa0-f42.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754748Ab3LDWWM (ORCPT ); Wed, 4 Dec 2013 17:22:12 -0500 Received: by mail-qa0-f42.google.com with SMTP id k4so7017727qaq.8 for ; Wed, 04 Dec 2013 14:22:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id; bh=26J8hZuMzVctNwVgPYcZa7+hfLHYtNApg9ljesV8HVg=; b=tqZ9qvtu5ut85VC0bSbjYsS+8ABv+CT7e2njftCpLMrdN74kTHRJ+Unr6LP8CSTAlV eJumW+kbkiclVaThmk0L1IRXBNrnfqLYZqNcvPzWK8Fzp7pQFOHmVZkCa/zNZwWLCKX6 /JXBUdoPofXp3URjQjvIh5YIuG4GPxcgr5VB0+pDuvU2t4TjsNT3Pa5xuPTV8OorFu1Y t8laroyW+ZDr+prv78I5s3yWG3wO1KvoDM0/A8/BftECj8uoMMzaDsY4xgpP/mMLjIPk yaAUToDIC4IJ644dxRjyBTqddOMzKYsazPXmAmF2nVX+cNF3g2Oz5NybooMy3257LZpV 0GDg== X-Received: by 10.224.148.9 with SMTP id n9mr66912083qav.32.1386195731445; Wed, 04 Dec 2013 14:22:11 -0800 (PST) Received: from localhost.localdomain ([177.194.40.144]) by mx.google.com with ESMTPSA id lc1sm21961714qeb.5.2013.12.04.14.22.09 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 04 Dec 2013 14:22:10 -0800 (PST) From: Fabio Estevam To: wsa@the-dreams.de Cc: linux-i2c@vger.kernel.org, Fabio Estevam Subject: [PATCH] i2c: i2c-imx: Check the return value from clk_prepare_enable() Date: Wed, 4 Dec 2013 20:21:37 -0200 Message-Id: <1386195697-4417-1-git-send-email-festevam@gmail.com> X-Mailer: git-send-email 1.8.1.2 Sender: linux-i2c-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-i2c@vger.kernel.org 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/i2c/busses/i2c-imx.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/i2c/busses/i2c-imx.c b/drivers/i2c/busses/i2c-imx.c index 1d7efa3..d0cfbb4 100644 --- a/drivers/i2c/busses/i2c-imx.c +++ b/drivers/i2c/busses/i2c-imx.c @@ -312,7 +312,9 @@ static int i2c_imx_start(struct imx_i2c_struct *i2c_imx) dev_dbg(&i2c_imx->adapter.dev, "<%s>\n", __func__); - clk_prepare_enable(i2c_imx->clk); + result = clk_prepare_enable(i2c_imx->clk); + if (result) + return result; imx_i2c_write_reg(i2c_imx->ifdr, i2c_imx, IMX_I2C_IFDR); /* Enable I2C controller */ imx_i2c_write_reg(i2c_imx->hwdata->i2sr_clr_opcode, i2c_imx, IMX_I2C_I2SR);