From patchwork Fri Aug 4 02:59:32 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 109362 Delivered-To: patch@linaro.org Received: by 10.140.101.6 with SMTP id t6csp1593192qge; Thu, 3 Aug 2017 20:00:05 -0700 (PDT) X-Received: by 10.84.232.76 with SMTP id f12mr973244pln.249.1501815605284; Thu, 03 Aug 2017 20:00:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1501815605; cv=none; d=google.com; s=arc-20160816; b=LRWjPnGCGyhQH3ATvE+BJkcG6x8hA/7Fu0EZG3Zb4Jge9UzDWEHBymmDaMJy2jy8HP 1uysZyv5mMsQeeZnrQYiD5zPDU1p8dMHHSY7OJtE14oFS+6eiemOdWRM8PvuPwZ91ZsH dMtwwn+KKprSbOgsoumtE4I/JXKj7/3UNG3+nLVsI3x9zW4bGJPD6mpxMItljM6cyxfZ mogSHwSBKKr8fxsWglN7NVE36eIlt0QNvm8H435Fjw57fgMK3Wo1JwJAQqVYJwjAi0kk AnknrvJMJRA7/xeUsP3IHQNvdO+4Gi0tXcjkkq/og19OdWDiiMVq2l42AbgNW9eIH6PX al8w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dkim-signature:dkim-filter:arc-authentication-results; bh=IFnMPEXy4rJTr5L2S8sG9rxgI1eeHS6Y03OY8R+lWas=; b=zlpF8UxlQLnmWBAIpwu8riV2BuqndyUE1/wzorgqlkiBW4Hq5CrziqwhCTLUcmYkf4 YjNtGzJxTlF6maryuEvdiEDplJ7QehB8Xh6ARjB1/YbgrN/51o+OQ4D++vffHJ1cQ/OO zJB2GAjzWzW+PBaY6Hr3rdYmUz4flF5CkcqmrC5ymW21eBCiSI2qfW++lJQJ+8LYHrnG hVlFp0yr0vIPJOA7imyL/INMMTV4FTaygB/XS2oQL90NxZ47Uy3EALlp/24WjCLi6UH8 U9oBnKyJNYo/7BODsDvEQYiRlOqb7bzY2Gfvci6jJ2WvKL44npXasKv+9wTWr3P7i74L eoCw== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@nifty.com header.b=VVfVqu7P; spf=pass (google.com: best guess record for domain of linux-gpio-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-gpio-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 136si292214pgc.239.2017.08.03.20.00.05; Thu, 03 Aug 2017 20:00:05 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-gpio-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@nifty.com header.b=VVfVqu7P; spf=pass (google.com: best guess record for domain of linux-gpio-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-gpio-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751891AbdHDDAE (ORCPT + 4 others); Thu, 3 Aug 2017 23:00:04 -0400 Received: from conuserg-08.nifty.com ([210.131.2.75]:21640 "EHLO conuserg-08.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751845AbdHDDAD (ORCPT ); Thu, 3 Aug 2017 23:00:03 -0400 Received: from pug.e01.socionext.com (p14092-ipngnfx01kyoto.kyoto.ocn.ne.jp [153.142.97.92]) (authenticated) by conuserg-08.nifty.com with ESMTP id v742xiZ8005507; Fri, 4 Aug 2017 11:59:44 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-08.nifty.com v742xiZ8005507 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1501815584; bh=UcdOk7OugVWaRpX6vUIuwEhGb5iMInI/+K9MbeqrSEM=; h=From:To:Cc:Subject:Date:From; b=VVfVqu7Pl88XEfgEvC4RGlu16e9y71F9Tt2EweB3zq2fgZfSAEnAK7vdZ0fOIThZQ fjbtDa3uRnKQJ2w38QqrQou+i86m/LtxGyH7N+2xraRTSTQm8sJcI9M1q9B2PweaGB DOTSv3GjiIXMEuIg3NqFRKh4QC2wPDUbxjP26GppTNqEB3f7wdBIjKpi5r9TUPQ6Pv 8KqEvN9YWt4VVPzZTAeklegM4KjCD4Oharf2mLJhjCXb3bcR09cBi+SiCoDOrcCe8v ZMQAmJ0jN4CtXZF0xKr2oZrMpJ2H49aiA2PJsudqH9tFIJvNMFQGyiJ3CH3mYwhoeV SFFA2oa3nzJZQ== X-Nifty-SrcIP: [153.142.97.92] From: Masahiro Yamada To: linux-gpio@vger.kernel.org Cc: Andy Shevchenko , Mika Westerberg , Masahiro Yamada , Linus Walleij , linux-kernel@vger.kernel.org Subject: [PATCH] pinctrl: check ops->pin_config_set in pinconf_set_config() Date: Fri, 4 Aug 2017 11:59:32 +0900 Message-Id: <1501815572-2792-1-git-send-email-yamada.masahiro@socionext.com> X-Mailer: git-send-email 2.7.4 Sender: linux-gpio-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-gpio@vger.kernel.org pinconf_set_config() is called by pinctrl_gpio_set_config(). If a GPIO driver is backed by a pinctrl driver and it does not support .pin_config_set() hook, it causes NULL pointer dereference. Fixes: 15381bc7c7f5 ("pinctrl: Allow configuration of pins from gpiolib based drivers") Signed-off-by: Masahiro Yamada --- drivers/pinctrl/pinconf.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- 2.7.4 -- To unsubscribe from this list: send the line "unsubscribe linux-gpio" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Acked-by: Mika Westerberg diff --git a/drivers/pinctrl/pinconf.c b/drivers/pinctrl/pinconf.c index 92f363793f35..d3fe14394b73 100644 --- a/drivers/pinctrl/pinconf.c +++ b/drivers/pinctrl/pinconf.c @@ -205,7 +205,7 @@ int pinconf_set_config(struct pinctrl_dev *pctldev, unsigned pin, const struct pinconf_ops *ops; ops = pctldev->desc->confops; - if (!ops) + if (!ops || !ops->pin_config_set) return -ENOTSUPP; return ops->pin_config_set(pctldev, pin, configs, nconfigs);