Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp665597pxk; Wed, 16 Sep 2020 13:48:59 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwBnp3O9/p+oCqJbW3eBa7itEzIR4FcMdC5M6cBbZPbS0CWT8zTOuw7Qaczqb8yvmd1+1Rj X-Received: by 2002:a17:906:60d5:: with SMTP id f21mr27179724ejk.94.1600289339512; Wed, 16 Sep 2020 13:48:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1600289339; cv=none; d=google.com; s=arc-20160816; b=YLjoe+4dj9QvhXF9a+OgSYHW55ilnBhNbQH5W1JUNKPbv3kgLm83gjWhvE1khGTI99 nQZ3LwFhIw9qW/H2mm1x5tuJPrfzzyqLgfA9W/ULYcbZ819OOev3C3QOnL82nEqfWDuR o//YhT5xrwx3RgIvA0EtDS5uMnuQ4Gt7W+ohbSdpkEf/Wakv3eeJdbVg8sAWSX3+FCW4 uYyQJ7PCdxuMo/YOFFX+rADLHtH8IoLml36yXwWUfMr3u4RXCt1tp3wsi4AiPZCkt2yJ LqWv5cNoVTeiVMc3BCW9qFCbEXHAToo8BihePyWLxZol928gnRrk8UqdnDeyk108rurj 3FSg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:organization:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:ironport-sdr:ironport-sdr; bh=f8hCjK1JvdQvS/iX40p3CUUAzwKyOHB1pvvq8uB7pgY=; b=n+ULZy+PeE9MMQfUhrw2qBbbOk8xXXMsppe68MF4fY90o3ePq76rLmIWayiLjmtlx+ iFMpWuMp/yfCHiuHrgkXqRd0kwKlJWROZVBMewBOglGFI7d5ZMNVn9nSX7u+QSi8jz8D N1PLetZBjbXZdGoykZInbU0YEl3zO1EdSyr14l271yhP9dijkhXXTg1xmtcnCbFDVcRU LFTAYdiv1ox/7rv+zQOA1tJG25XeRrWAXwUBoaRQQl15snNnR0AwgcYzlyVvWf4GeWzy 1D8LvSHEYcFiIqdQ9oGGtHZA5xbyrLs6TcaP2JjkK4bqzIzj9zFIlai0RzkUVx3t4R3O NQog== ARC-Authentication-Results: i=1; mx.google.com; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id t5si13772929edi.523.2020.09.16.13.48.36; Wed, 16 Sep 2020 13:48:59 -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; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727022AbgIPUpq (ORCPT + 99 others); Wed, 16 Sep 2020 16:45:46 -0400 Received: from mga03.intel.com ([134.134.136.65]:21603 "EHLO mga03.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726325AbgIPRDY (ORCPT ); Wed, 16 Sep 2020 13:03:24 -0400 IronPort-SDR: 0S+lRSoIFN1hNt1uyl4BizDuBXwzBRsTUFIYFjCPa6ZXIJ0Dbka/0/aZ+Bcf6hFu5QN4F5Xbd4 sl440QxVMHAw== X-IronPort-AV: E=McAfee;i="6000,8403,9745"; a="159522952" X-IronPort-AV: E=Sophos;i="5.76,433,1592895600"; d="scan'208";a="159522952" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga008.jf.intel.com ([10.7.209.65]) by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 16 Sep 2020 07:29:37 -0700 IronPort-SDR: JLxWPzmpU6s9li6Ml4Q2lqYdMMIDVcaFdVWu1zenXIZs0Q9diPfrJ+nt76t3ZcgyCOsIBZl8YS vfwsGEKSfZpw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.76,433,1592895600"; d="scan'208";a="336040902" Received: from smile.fi.intel.com (HELO smile) ([10.237.68.40]) by orsmga008.jf.intel.com with ESMTP; 16 Sep 2020 07:29:33 -0700 Received: from andy by smile with local (Exim 4.94) (envelope-from ) id 1kIYR8-00H6Ky-0Q; Wed, 16 Sep 2020 17:29:30 +0300 Date: Wed, 16 Sep 2020 17:29:30 +0300 From: Andy Shevchenko To: Bartosz Golaszewski Cc: Linus Walleij , Mika Westerberg , Kent Gibson , Anders Roxell , linux-gpio@vger.kernel.org, linux-next@vger.kernel.org, linux-kernel@vger.kernel.org, Bartosz Golaszewski Subject: Re: [PATCH next] gpiolib: check for parent device in devprop_gpiochip_set_names() Message-ID: <20200916142930.GK3956970@smile.fi.intel.com> References: <20200916134327.3435-1-brgl@bgdev.pl> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200916134327.3435-1-brgl@bgdev.pl> Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Sep 16, 2020 at 03:43:27PM +0200, Bartosz Golaszewski wrote: > 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. Ah, nice! Can we also add a small comment in the code, b/c w/o it I would stumble over and eager to remove looks-as-unneeded check? Reviewed-by: Andy Shevchenko > 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 > -- With Best Regards, Andy Shevchenko