From patchwork Thu Sep 12 12:36:47 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Guennadi Liakhovetski X-Patchwork-Id: 2878261 Return-Path: X-Original-To: patchwork-linux-sh@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 4FB8ABF43F for ; Thu, 12 Sep 2013 12:37:06 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 9AB06200B4 for ; Thu, 12 Sep 2013 12:37:01 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 6DE1B201B3 for ; Thu, 12 Sep 2013 12:37:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754737Ab3ILMg6 (ORCPT ); Thu, 12 Sep 2013 08:36:58 -0400 Received: from moutng.kundenserver.de ([212.227.17.9]:60010 "EHLO moutng.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754408Ab3ILMgy (ORCPT ); Thu, 12 Sep 2013 08:36:54 -0400 Received: from axis700.grange (dslb-088-076-068-089.pools.arcor-ip.net [88.76.68.89]) by mrelayeu.kundenserver.de (node=mrbap4) with ESMTP (Nemesis) id 0LpNZt-1VpYsW1wqT-00f7qZ; Thu, 12 Sep 2013 14:36:49 +0200 Received: from 6a.grange (6a.grange [192.168.1.11]) by axis700.grange (Postfix) with ESMTPS id 16B0140BB7; Thu, 12 Sep 2013 14:36:49 +0200 (CEST) Received: from lyakh by 6a.grange with local (Exim 4.72) (envelope-from ) id 1VK68e-0002lt-Rz; Thu, 12 Sep 2013 14:36:48 +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 v2 4/5] i2c: rcar: fix clk_get() error handling Date: Thu, 12 Sep 2013 14:36:47 +0200 Message-Id: <1378989408-10618-5-git-send-email-g.liakhovetski@gmx.de> X-Mailer: git-send-email 1.7.2.5 In-Reply-To: <1378989408-10618-1-git-send-email-g.liakhovetski@gmx.de> References: <1378989408-10618-1-git-send-email-g.liakhovetski@gmx.de> X-Provags-ID: V02:K0:wkUBf0vBL9Ecnz3g4InPrCspRCBsx1PWaEgvckQRWP+ X5pcU+XB2AyoUxf1v6aM/pxbP1KyAjCL8Mv67OKSmLqpzibyR6 wXrKovzl1JASq2cRx2KHSpCtUYvCZes8rzNkQNem0/TAVluPjS 6V8ABZDGV/BEaMNgDfuzc12ScASdNBpm9+wvWWjT87WDv4dQqj cn8uwmehVOJ7grvDlwgG4U/HJWfjV5Wu9ci8NgERSpMWN5E/eZ RmHildCabH77yLL8qJY29AE8BQEy/GIXWhfLXgSwnavYoH76Nf eXpP65BXVC1RXlNpid7soQWWFic2ZOIxhUFcf3YZDHFLm7JuV9 LP/+GFxABfljlCJnpRwz5WslV7XFdcdKGhYVSm1QEPb5bjBn7b qOkATOT0ls1HA== Sender: linux-sh-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-sh@vger.kernel.org X-Spam-Status: No, score=-7.8 required=5.0 tests=BAYES_00,FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, 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 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 1f285a3..98276eb 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) {