From patchwork Sat Feb 23 17:57:46 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Heiko Stuebner X-Patchwork-Id: 222742 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 B703F2C02B8 for ; Sun, 24 Feb 2013 04:57:51 +1100 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756938Ab3BWR5t (ORCPT ); Sat, 23 Feb 2013 12:57:49 -0500 Received: from gloria.sntech.de ([95.129.55.99]:55922 "EHLO gloria.sntech.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755041Ab3BWR5t (ORCPT ); Sat, 23 Feb 2013 12:57:49 -0500 Received: from 178-25-111-196-dynip.superkabel.de ([178.25.111.196] helo=marty.localnet) by gloria.sntech.de with esmtpsa (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.72) (envelope-from ) id 1U9JM4-0006DE-05; Sat, 23 Feb 2013 18:57:48 +0100 From: Heiko =?utf-8?q?St=C3=BCbner?= To: Linus Walleij , Wolfram Sang Subject: [PATCH] i2c: s3c2410: check for NULL pinctrl handle Date: Sat, 23 Feb 2013 18:57:46 +0100 User-Agent: KMail/1.13.7 (Linux/3.2.0-3-686-pae; KDE/4.8.4; i686; ; ) Cc: linux-kernel@vger.kernel.org, Kukjin Kim , linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org, linux-i2c@vger.kernel.org, Tomasz Figa References: <201302231855.47560.heiko@sntech.de> In-Reply-To: <201302231855.47560.heiko@sntech.de> MIME-Version: 1.0 Message-Id: <201302231857.46445.heiko@sntech.de> Sender: linux-i2c-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-i2c@vger.kernel.org When pinctrl is not built the fallback functions fail silently and emit either 0 error codes or NULL pinctrl handles. Therefore it's needed to also check for this NULL-handle when falling back to parsing the i2c gpios from devicetree. Signed-off-by: Heiko Stuebner --- drivers/i2c/busses/i2c-s3c2410.c | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-) diff --git a/drivers/i2c/busses/i2c-s3c2410.c b/drivers/i2c/busses/i2c-s3c2410.c index f6b880b..e58337f 100644 --- a/drivers/i2c/busses/i2c-s3c2410.c +++ b/drivers/i2c/busses/i2c-s3c2410.c @@ -1060,7 +1060,8 @@ static int s3c24xx_i2c_probe(struct platform_device *pdev) if (i2c->pdata->cfg_gpio) { i2c->pdata->cfg_gpio(to_platform_device(i2c->dev)); - } else if (IS_ERR(i2c->pctrl) && s3c24xx_i2c_parse_dt_gpio(i2c)) { + } else if ((!i2c->pctrl || IS_ERR(i2c->pctrl)) && + s3c24xx_i2c_parse_dt_gpio(i2c)) { return -EINVAL; }