Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp882273ybi; Fri, 2 Aug 2019 05:57:26 -0700 (PDT) X-Google-Smtp-Source: APXvYqzZqXMsVknM7EB+YWGEHTnXQ+4yo7gqbu0JG/Ms6+pldeOvx/5mqrIKV+iDb6VD296drcoX X-Received: by 2002:a17:902:724c:: with SMTP id c12mr128888396pll.219.1564750646164; Fri, 02 Aug 2019 05:57:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1564750646; cv=none; d=google.com; s=arc-20160816; b=ce2hFEh3Zm7oWvE+8SeL/ZkWGh/Ys4O7s52Bp6R3NI9DAM5TUCLLoEiuJoMK4GkxL4 DWto+MXwbPqo4M6Xv2XJl3izpW8hf7fa8CyDvmoZTMHyMYI0oGDosV+6f8usPJU9SYS4 6lrTgSXWhXZHDNHjPOuhzXxpSEE7anERx2kE0YZU62yKNRPFU/kvp+SosdVBLT9WEgAP Eds0St1Ir2TBz9pqRN2/35U3CQi6tPQpqnnJc6IsOSmeTGRNfTQ92pJ0/zyXwtfst7jc tpDjWwbaOx0KE8ZaQBypX6HS0opguw4ni/B1U/y2EXh/FK13werVEuTP2Cm5tYfwShyY avYQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-transfer-encoding:content-disposition:mime-version :references:message-id:subject:cc:to:from:date; bh=mKLrV2aK0ZpYhnmRmuBlu2Y50JZePqtu0rSj75GoL6A=; b=MeR53WZlqYni3w/W3WrKX2nKJ9KcfirE53BUgKHe4PxgewJmAJyYQ/KDk16P0xmgEc mlL26mfuOqqYdsPzw1Eul4taClVkBAc2dNFlujpXXU4zc+2iYo6bqTUeJzcXkiKgQkat lKSxWG1cXx09cMqvcZuqdKsFOqJH+4tRawi4fwER6Ce1/oLgSJL9NQV5pF+9rjf3Tkd8 IWhayCco8SbQNy7K5HT8tvQjZq/RLnJiduA8LMhtKXbGtSc/pcJAPcfOU0Z5z5qU6kFy SvFSK++0Ho38Yq1fhfWj0VOagkFhh6sMahWW5ZR29YzcIgEaqKOF1xdtP3S7QpO5Y+Em NBCA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-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 o70si35726814pgo.280.2019.08.02.05.57.11; Fri, 02 Aug 2019 05:57:26 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2404109AbfHBIYw (ORCPT + 99 others); Fri, 2 Aug 2019 04:24:52 -0400 Received: from metis.ext.pengutronix.de ([85.220.165.71]:40577 "EHLO metis.ext.pengutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726164AbfHBIYv (ORCPT ); Fri, 2 Aug 2019 04:24:51 -0400 Received: from pty.hi.pengutronix.de ([2001:67c:670:100:1d::c5]) by metis.ext.pengutronix.de with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1htSrk-0001JP-AM; Fri, 02 Aug 2019 10:24:44 +0200 Received: from ukl by pty.hi.pengutronix.de with local (Exim 4.89) (envelope-from ) id 1htSrh-0000NT-R6; Fri, 02 Aug 2019 10:24:41 +0200 Date: Fri, 2 Aug 2019 10:24:41 +0200 From: Uwe =?iso-8859-1?Q?Kleine-K=F6nig?= To: Schrempf Frieder Cc: "linux-serial@vger.kernel.org" , "geert+renesas@glider.be" , "shawnguo@kernel.org" , "s.hauer@pengutronix.de" , Jiri Slaby , "linux-kernel@vger.kernel.org" , "linux-imx@nxp.com" , "kernel@pengutronix.de" , Greg Kroah-Hartman , "festevam@gmail.com" , "linux-arm-kernel@lists.infradead.org" Subject: Re: [PATCH v2 1/3] serial: mctrl_gpio: Avoid probe failures in case of missing gpiolib Message-ID: <20190802082441.udsrc5ev4nwj7abz@pengutronix.de> References: <20190801184505.17239-1-frieder.schrempf@kontron.de> <20190801203316.7ntlv6hequmddfxu@pengutronix.de> <011ac0ac-571e-b898-2b2d-89b9a771b0c1@kontron.de> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <011ac0ac-571e-b898-2b2d-89b9a771b0c1@kontron.de> User-Agent: NeoMutt/20170113 (1.7.2) X-SA-Exim-Connect-IP: 2001:67c:670:100:1d::c5 X-SA-Exim-Mail-From: ukl@pengutronix.de X-SA-Exim-Scanned: No (on metis.ext.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-kernel@vger.kernel.org Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hello, On Fri, Aug 02, 2019 at 07:56:54AM +0000, Schrempf Frieder wrote: > On 01.08.19 22:33, Uwe Kleine-K?nig wrote: > > On Thu, Aug 01, 2019 at 06:45:21PM +0000, Schrempf Frieder wrote: > >> diff --git a/drivers/tty/serial/serial_mctrl_gpio.c b/drivers/tty/serial/serial_mctrl_gpio.c > >> index 2b400189be91..54c43e02e375 100644 > >> --- a/drivers/tty/serial/serial_mctrl_gpio.c > >> +++ b/drivers/tty/serial/serial_mctrl_gpio.c > >> @@ -61,6 +61,9 @@ EXPORT_SYMBOL_GPL(mctrl_gpio_set); > >> struct gpio_desc *mctrl_gpio_to_gpiod(struct mctrl_gpios *gpios, > >> enum mctrl_gpio_idx gidx) > >> { > >> + if (gpios == NULL) > >> + return NULL; > >> + > > > > I wonder why you need this. If GPIOLIB is off this code isn't active and > > with GPIOLIB calling mctrl_gpio_to_gpiod with a gpios == NULL is a bug > > that IMHO should not be silently ignored. > > > > Am I missing something (again)? > > No, you're right. My thoughts were, that if the mctrl_gpio functions are > allowed to be passed a NULL pointer in general, they all should have a > NULL check, even if in the current context (GPIOLIB disabled) this code > is not active. Apparently there are other cases when a NULL pointer is > passed, see [1]. So you can't really consider gpios == NULL to be a bug > as this seems to be allowed in general. OK, then this is another separate commit, right? Preferably with a comment pointing to drivers that use mctrl_gpio before being initialized. Best regards Uwe -- Pengutronix e.K. | Uwe Kleine-K?nig | Industrial Linux Solutions | http://www.pengutronix.de/ |