From patchwork Mon Sep 9 15:55:19 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Guennadi Liakhovetski X-Patchwork-Id: 273611 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 CDF242C00E8 for ; Tue, 10 Sep 2013 01:55:44 +1000 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755286Ab3IIPze (ORCPT ); Mon, 9 Sep 2013 11:55:34 -0400 Received: from moutng.kundenserver.de ([212.227.126.186]:59119 "EHLO moutng.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755268Ab3IIPz0 (ORCPT ); Mon, 9 Sep 2013 11:55:26 -0400 Received: from axis700.grange (dslb-178-006-084-108.pools.arcor-ip.net [178.6.84.108]) by mrelayeu.kundenserver.de (node=mreu0) with ESMTP (Nemesis) id 0MFflp-1VDGNY0wcP-00ENGL; Mon, 09 Sep 2013 17:55:21 +0200 Received: from 6a.grange (6a.grange [192.168.1.11]) by axis700.grange (Postfix) with ESMTPS id C814B40BB6; Mon, 9 Sep 2013 17:55:20 +0200 (CEST) Received: from lyakh by 6a.grange with local (Exim 4.72) (envelope-from ) id 1VJ3o8-0002uI-ID; Mon, 09 Sep 2013 17:55:20 +0200 From: Guennadi Liakhovetski To: linux-i2c@vger.kernel.org Cc: Magnus Damm , linux-sh@vger.kernel.org, Wolfram Sang , devicetree@vger.kernel.org, Grant Likely , Rob Herring , Guennadi Liakhovetski Subject: [PATCH 4/5] i2c: rcar: fix clk_get() error handling Date: Mon, 9 Sep 2013 17:55:19 +0200 Message-Id: <1378742120-11135-5-git-send-email-g.liakhovetski@gmx.de> X-Mailer: git-send-email 1.7.2.5 In-Reply-To: <1378742120-11135-1-git-send-email-g.liakhovetski@gmx.de> References: <1378742120-11135-1-git-send-email-g.liakhovetski@gmx.de> X-Provags-ID: V02:K0:pG1A2ibC1Wqk9QStPgbNkLZrRtDSSAcZ1tdUqdixmzL WdY0P8TYnyicO80vjoMIDr2JtAr1CO+PmSCKOh0eILnTCyXmQA nRNQX2DvT79WTITiWDgtKv0SMiMFLPQttmnLrsGSiLu/we0ZBg Nk87957xeedF7KMOideVZemK+mBXZk+1iBTx/TV0HceeXGWFhc fuN3SFckaPKg2FhE2j8ir8S9ybLNIZwCkRcLVNLJvaqYD04DzL hC4Ml3k1Y0BXsnx37CCnWIXgbWk+/UeOMzkEGYtpuQyXWs632U bvOcU2JVFiZdXRFxwLPtO9XqV581SfNKrPhZ2uKrxVHcVMR/Ig rNoFvXG9cuQNboI9Eb66Ynjr0hSq3F9QYLaB8kXgFSa/FsmPlL e/tfUD8Gxp4qg== Sender: linux-i2c-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-i2c@vger.kernel.org When clk_get() fails, it returns an error code, not a NULL. This patch fixes such an error handling bug. Signed-off-by: Guennadi Liakhovetski --- drivers/i2c/busses/i2c-rcar.c | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/i2c/busses/i2c-rcar.c b/drivers/i2c/busses/i2c-rcar.c index be801b9..7e71cf4 100644 --- a/drivers/i2c/busses/i2c-rcar.c +++ b/drivers/i2c/busses/i2c-rcar.c @@ -234,9 +234,9 @@ static int rcar_i2c_clock_calculate(struct rcar_i2c_priv *priv, u32 cdf_width; unsigned long rate; - if (!clkp) { - dev_err(dev, "there is no peripheral_clk\n"); - return -EIO; + if (IS_ERR(clkp)) { + dev_err(dev, "couldn't get clock\n"); + return PTR_ERR(clkp); } switch (priv->devtype) {