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 1E1D7C001B0 for ; Wed, 16 Aug 2023 10:22:38 +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=O2N1JQ4bfG59BEjJthi7m5Iz35Sg84vpXYdhGcIWoxc=; b=dO4JZj7yW7cV3/ SK1CBCbkh6sJ2aVrdahrlMerEh3R5kIA8STiwfuHyGaOj3wmtB8SbfsG5RcxQQ2WfvDqq/H7B005o U+ggG0aThWjCPZqvuyrHzMF/5n8TDcyGpephzSLHDArb/HCj6NA7wxH2XTBhIJGIJaKQ9zf66bTHI sQrYoCYUontU0KLa7uGGjvbVTXGcO8cKciylKC+30WvDa2eIrbcwM8M3tC5iASXUOsBgNYxgF9zsZ UbQMSUO74gI/SdsqCZoVLUjE9r+zX8hKxwuq1LeUstCTNRbU3S6CA22OnSngF2uavh07YBngv2xMD wkd8W3vVGBXwpbsT9VdQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qWDfF-003l2T-2b; Wed, 16 Aug 2023 10:22:09 +0000 Received: from [2001:4d48:ad52:32c8:5054:ff:fe00:142] (helo=pandora.armlinux.org.uk) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qWDfC-003kym-1m for linux-arm-kernel@lists.infradead.org; Wed, 16 Aug 2023 10:22:08 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=armlinux.org.uk; s=pandora-2019; h=Sender:In-Reply-To:Content-Type: MIME-Version:References:Message-ID:Subject:Cc:To:From:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=WWV/9y0xwOKfnJhNG1dl4bNZQhd6Mi2M16eWJXnMtHw=; b=gn5z4O79L5YuZvRg+C9dwtyS+W spwMEXwxzdaz9I7BqduJevmMfL8X1R32w5JQ0n0VREB8qe7vI9HQKZA2IYxxy2VLapzF4rwR7AuMU HYkg8e0ZWENmI2CqfxJrOvUInBlSpaMGE6v/S7Q7grMy6E3IzuSV3MSTj1SyoIs1Qxpa0dTCg/BVm rQUJEA2oUQm0NnYGqUuCvi0PapTKqRATc5PAv+iW1pDDhQs/p7/lxuhhhvBxqbp0Dc0b4aZudsZiA Cb8p8Mi3Vtz/0xuKMlrVrZVdCyk1Nc6U3absMv+hyIuo2QqB+bXTfEo0iEXoydhDU0Tm341t40p8b n918v9cA==; Received: from shell.armlinux.org.uk ([fd8f:7570:feb6:1:5054:ff:fe00:4ec]:53150) by pandora.armlinux.org.uk with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1qWDf8-0002eK-0g; Wed, 16 Aug 2023 11:22:02 +0100 Received: from linux by shell.armlinux.org.uk with local (Exim 4.94.2) (envelope-from ) id 1qWDf6-0007wF-4P; Wed, 16 Aug 2023 11:22:00 +0100 Date: Wed, 16 Aug 2023 11:22:00 +0100 From: "Russell King (Oracle)" To: Ruan Jinjie Subject: Re: [PATCH -next] I2C: Use helper function IS_ERR_OR_NULL() Message-ID: References: <20230816094618.2854084-1-ruanjinjie@huawei.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20230816094618.2854084-1-ruanjinjie@huawei.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230816_032206_593301_DE1DAE33 X-CRM114-Status: GOOD ( 18.53 ) 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 , Sascha Hauer , Claudiu Beznea , linux-i2c@vger.kernel.org, Pengutronix Kernel Team , Codrin Ciubotariu , Oleksij Rempel , Shawn Guo , 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 Wed, Aug 16, 2023 at 05:46:18PM +0800, Ruan Jinjie wrote: > Use IS_ERR_OR_NULL() instead of open-coding it > to simplify the code. > > Signed-off-by: Ruan Jinjie > --- > drivers/i2c/busses/i2c-at91-master.c | 2 +- > drivers/i2c/busses/i2c-imx.c | 2 +- > 2 files changed, 2 insertions(+), 2 deletions(-) > > diff --git a/drivers/i2c/busses/i2c-at91-master.c b/drivers/i2c/busses/i2c-at91-master.c > index 94cff1cd527e..0e454c04a145 100644 > --- a/drivers/i2c/busses/i2c-at91-master.c > +++ b/drivers/i2c/busses/i2c-at91-master.c > @@ -831,7 +831,7 @@ static int at91_init_twi_recovery_gpio(struct platform_device *pdev, > struct i2c_bus_recovery_info *rinfo = &dev->rinfo; > > rinfo->pinctrl = devm_pinctrl_get(&pdev->dev); > - if (!rinfo->pinctrl || IS_ERR(rinfo->pinctrl)) { > + if (IS_ERR_OR_NULL(rinfo->pinctrl)) { > dev_info(dev->dev, "can't get pinctrl, bus recovery not supported\n"); > return PTR_ERR(rinfo->pinctrl); > } > diff --git a/drivers/i2c/busses/i2c-imx.c b/drivers/i2c/busses/i2c-imx.c > index 10e89586ca72..8807c90df749 100644 > --- a/drivers/i2c/busses/i2c-imx.c > +++ b/drivers/i2c/busses/i2c-imx.c > @@ -1388,7 +1388,7 @@ static int i2c_imx_init_recovery_info(struct imx_i2c_struct *i2c_imx, > struct i2c_bus_recovery_info *rinfo = &i2c_imx->rinfo; > > i2c_imx->pinctrl = devm_pinctrl_get(&pdev->dev); > - if (!i2c_imx->pinctrl || IS_ERR(i2c_imx->pinctrl)) { > + if (!IS_ERR_OR_NULL(i2c_imx->pinctrl)) { > dev_info(&pdev->dev, "can't get pinctrl, bus recovery not supported\n"); > return PTR_ERR(i2c_imx->pinctrl); > } As stated in my previous reply to a similar patch, devm_pinctrl_get() can not return NULL, so it makes more sense to remove the test for NULL rather than "cleaning up" the buggy code, but leaving the bugs behind. -- RMK's Patch system: https://www.armlinux.org.uk/developer/patches/ FTTP is here! 80Mbps down 10Mbps up. Decent connectivity at last! _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel