From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 1B4B1C27C40 for ; Thu, 24 Aug 2023 08:35:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=CV4L/tnAkYpNZOdqvA66UxlKtkzYIfsTs/7effo+eVQ=; b=R0STq6Gz4qtd15 hpQPxtfK3Ep94q/hmZS8xBAgrzQdkYdTxtIsdNml7neo3/xNvloTkNj48bqMqz7S2SK/4NhF8ACSH NtLUVkegJpoWVcXtWbRtj2tG+zkoBOHCC6JlnS++Z7ux9Gmf29kcmW3cYACHQVbQIqG7d4ODgqiWB /0XHnlzZLEPIZXyRz5Z6qYBTv6RcmBXeRXsPvulhZrWq6oXWhKtwKbawtFPXyeoSn21Ke1tv9eXfL 7T7bvUJyJ1oxufHcNDwIaTxELdlMfsXv4MLzjLaKYfKXB8CW1LUMNkNBdKkEPIZYFRKMZOBGO4Cq6 K+ZKwsMeHZI4lHdI3TAw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qZ5oE-002aIL-16; Thu, 24 Aug 2023 08:35:18 +0000 Received: from metis.ext.pengutronix.de ([2001:67c:670:201:290:27ff:fe1d:cc33]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qZ5oA-002aGL-36 for linux-arm-kernel@lists.infradead.org; Thu, 24 Aug 2023 08:35:16 +0000 Received: from ptx.hi.pengutronix.de ([2001:67c:670:100:1d::c0]) by metis.ext.pengutronix.de with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1qZ5nq-0002gQ-NO; Thu, 24 Aug 2023 10:34:54 +0200 Received: from ore by ptx.hi.pengutronix.de with local (Exim 4.92) (envelope-from ) id 1qZ5np-0000Hv-3Z; Thu, 24 Aug 2023 10:34:53 +0200 Date: Thu, 24 Aug 2023 10:34:53 +0200 From: Oleksij Rempel To: Jinjie Ruan Subject: Re: [PATCH -next v3] I2C: Make return value check more accurate and explicit for devm_pinctrl_get() Message-ID: <20230824083453.GB31399@pengutronix.de> References: <20230821032914.1976317-1-ruanjinjie@huawei.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20230821032914.1976317-1-ruanjinjie@huawei.com> X-Sent-From: Pengutronix Hildesheim X-URL: http://www.pengutronix.de/ X-Accept-Language: de,en X-Accept-Content-Type: text/plain User-Agent: Mutt/1.10.1 (2018-07-13) X-SA-Exim-Connect-IP: 2001:67c:670:100:1d::c0 X-SA-Exim-Mail-From: ore@pengutronix.de X-SA-Exim-Scanned: No (on metis.ext.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-arm-kernel@lists.infradead.org X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230824_013515_001959_4AA0F075 X-CRM114-Status: GOOD ( 25.49 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Alexandre Belloni , Andi Shyti , Fabio Estevam , linus.walleij@linaro.org, linux@armlinux.org.uk, linux-i2c@vger.kernel.org, Pengutronix Kernel Team , Claudiu Beznea , Codrin Ciubotariu , Oleksij Rempel , Shawn Guo , Sascha Hauer , linux-arm-kernel@lists.infradead.org, NXP Linux Team Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Mon, Aug 21, 2023 at 11:29:14AM +0800, Jinjie Ruan wrote: > If pinctrl is not available (thus devm_pinctrl_get() returns NULL) then > recovery can't work, because we can't switch the I2C pins between the > I2C controller and GPIO. So, it is quite correct to print > "can't get pinctrl, bus recovery not supported" because the I2C bus > can't be recovered without pinctrl. > > The PTR_ERR() is also fine - because if pinctrl is not present and > returns NULL, we'll end up returning zero, which is exactly what we > want. > > However, open code that with a more accurate message will be more explicit > for NULL case when CONFIG_PINCTRL is not defined. > > Signed-off-by: Jinjie Ruan > Acked-by: Oleksij Rempel > Reviewed-by: Linus Walleij > Acked-by: Nicolas Ferre > Suggested-by: Russell King (Oracle) > --- > v3: > - Split into two if() statements instead of removing the NULL checks. > - Remove the fix tags. > - Update the commit title and message. > - Update to bring the author's name before. > v2: > - Remove NULL check instead of using IS_ERR_OR_NULL() to avoid leaving them behind. > - Update the commit title and message. > --- > drivers/i2c/busses/i2c-at91-master.c | 6 +++++- > drivers/i2c/busses/i2c-imx.c | 6 +++++- > 2 files changed, 10 insertions(+), 2 deletions(-) Acked-by: Oleksij Rempel for the i2c-imx.c Thank you! Regards, Oleksij -- Pengutronix e.K. | | Steuerwalder Str. 21 | http://www.pengutronix.de/ | 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 | _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel