Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp563449pxk; Wed, 16 Sep 2020 10:52:04 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx7eHzaRbJIruv0bosPEtOKAerIPArZ3EcO7asfMd1MOUhRekV8AlFChONZf/gkynwdIZS7 X-Received: by 2002:a05:6402:1151:: with SMTP id g17mr29530294edw.227.1600278724339; Wed, 16 Sep 2020 10:52:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1600278724; cv=none; d=google.com; s=arc-20160816; b=JybhTEBVOC5e5NRccbf0YG10K1DrrXua9w/AC1qRE3QO+0Ph47NkeVMuX8OLZgpi9F WO4DvbT027fjeW4m3uj+ZoBzWA2rNpKQ3GgHLjZywfSeBG7l9hRp1Pj8KO9Z13EFlikq nsTFi5dWGVF0rZnh5tkS9kC9H1JxQcoYKdxyKRyB8YmyzM0kTT/i3Vy689SFGaq0kDb3 dwJemnuDNgGJ+9gB7yTUJNoB82yilzMt1kmBNEoxp2suSx/SmNlqUCDOevU/ZytqiwDF k4jlUTpDE6IIY/nDScSuBJciLvmoTkwxnkD3f4/lrqsOOvzCO4a/r1GkaS/iCBO9NdyU 5KTQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=KWaDQ7uhIqw2OfY7WhIv98jjbgPy0IbYqKs55rRj5Ms=; b=A8wREE4kMAzFD6adrIi00KynBDsPhRrqEV9CL2QnJ+p1COVe/gaVIrTwdWLkZJKfVZ 7LNyQdC/H9MA8iG6ENz/q2I4Hs3bczPvzWHFGx4ix5g/s+eanUz8p0p8H2N0vXulDT58 Xbb4JfAn+bkHHmoHwBZyBNybzUvYPX6q2YRDmx/eikoKy+xn8XMpV6JidEQIwGfnQnBQ uKgSZdy/+vJku0n0ZKyx0inZQ3QVY+9BIKGZy3Qg5ixH2Eq5P9Lo+oK0pz0azQD3Ls/v zBSG5q3fy2ez/JQ7cbPFb+1b7O5t+xIQ9DIqZ6+31FCefztl574WOHj50fv7aNBZ58vT nwvA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bgdev-pl.20150623.gappssmtp.com header.s=20150623 header.b=i9BalPT4; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id v13si12109175eja.325.2020.09.16.10.51.41; Wed, 16 Sep 2020 10:52:04 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@bgdev-pl.20150623.gappssmtp.com header.s=20150623 header.b=i9BalPT4; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727525AbgIPRst (ORCPT + 99 others); Wed, 16 Sep 2020 13:48:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35760 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727480AbgIPRsf (ORCPT ); Wed, 16 Sep 2020 13:48:35 -0400 Received: from mail-wr1-x444.google.com (mail-wr1-x444.google.com [IPv6:2a00:1450:4864:20::444]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A34CEC0086B7 for ; Wed, 16 Sep 2020 06:43:46 -0700 (PDT) Received: by mail-wr1-x444.google.com with SMTP id o5so6918756wrn.13 for ; Wed, 16 Sep 2020 06:43:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bgdev-pl.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=KWaDQ7uhIqw2OfY7WhIv98jjbgPy0IbYqKs55rRj5Ms=; b=i9BalPT4mWy0zyrOLfTWbIOF6KnoctQ96zFUjXi1v5Y4OjC11p6V2XZlW9IXv2YUA+ RULN16fN1TvTqYSHWiIBKnGFZNdIC317uMj6SJzcbar9WeItWypLMMHI4wGzYAHqPJXW cTtDv9q5DKw+EmrS0E+asIx9o5mZjlcC3+cv1Pe4gKL8MxdWYi8otF3RzIG5HJKWCv1/ MYqAR1bKomXraD48pOFvLCvjtF27vYtQVqtIjTKC99MVFheSfOsl8OACeTV0SA4mzXPy ozAk2zBwF7g47bPxnQconu8gXT7DGul3kQS8wMnXHt/ma+QPDwiw/USCwL2/NhAkmiD3 5NOQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=KWaDQ7uhIqw2OfY7WhIv98jjbgPy0IbYqKs55rRj5Ms=; b=bn/vW5gsULyP19vSsIeZfGAgvqwEGtDbsLBMRDFZ+YG36RUZJJcD8sLWnVVWUKq+Mb ZFdSsFp+hehi1p30ojXyzxkpHX314XAIttL8EGnLWa/dA4PMUR144NXY+7k+oALHc9PA 76/SXKs7X/fEc74fGu/aAC07+WSRL2G07pQ7+RPia+FhDwyrwOa5qUpLD2waAPCeR0V9 BKT2cFNJ98LPx2d9GRmSjDpxfENRppmVUtWwU8fmKpZGfj8aBXbs0iJmfOZ0HQ4X9E6j G5FmIp5z6vRpCQNboKItJpO4JJ7CRpX5Pct2+OQT+EcCBpAb9r0/WBzvtohTa2q7/1fp uRFw== X-Gm-Message-State: AOAM533y+mtUqNgAsVOvNYzHn4vmlmjhFNwaFTZp+iWQhxe8OHGfHQNL mY5ei4fcT/11OXh+nFLEmZO/rg== X-Received: by 2002:a5d:4842:: with SMTP id n2mr27318888wrs.260.1600263825354; Wed, 16 Sep 2020 06:43:45 -0700 (PDT) Received: from debian-brgl.home (lfbn-nic-1-68-20.w2-15.abo.wanadoo.fr. [2.15.159.20]) by smtp.gmail.com with ESMTPSA id 2sm5255813wmf.25.2020.09.16.06.43.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 16 Sep 2020 06:43:44 -0700 (PDT) From: Bartosz Golaszewski To: Linus Walleij , Mika Westerberg , Andy Shevchenko , Kent Gibson , Anders Roxell Cc: linux-gpio@vger.kernel.org, linux-next@vger.kernel.org, linux-kernel@vger.kernel.org, Bartosz Golaszewski Subject: [PATCH next] gpiolib: check for parent device in devprop_gpiochip_set_names() Date: Wed, 16 Sep 2020 15:43:27 +0200 Message-Id: <20200916134327.3435-1-brgl@bgdev.pl> X-Mailer: git-send-email 2.26.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Bartosz Golaszewski It's possible for a GPIO chip to not have a parent device (whose properties we inspect for 'gpio-line-names'). In this case we should simply return from devprop_gpiochip_set_names(). Add an appropriate check for this use-case. Fixes: 7cba1a4d5e16 ("gpiolib: generalize devprop_gpiochip_set_names() for device properties") Reported-by: Anders Roxell Signed-off-by: Bartosz Golaszewski --- drivers/gpio/gpiolib.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c index b7b608ef9..ac2c77edc 100644 --- a/drivers/gpio/gpiolib.c +++ b/drivers/gpio/gpiolib.c @@ -375,6 +375,9 @@ static int devprop_gpiochip_set_names(struct gpio_chip *chip) int ret, i; int count; + if (!dev) + return 0; + count = device_property_string_array_count(dev, "gpio-line-names"); if (count < 0) return 0; -- 2.26.1