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 X-Spam-Level: X-Spam-Status: No, score=-2.2 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id B367AC47404 for ; Fri, 4 Oct 2019 20:39:48 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 8F3B421D81 for ; Fri, 4 Oct 2019 20:39:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388318AbfJDUjr (ORCPT ); Fri, 4 Oct 2019 16:39:47 -0400 Received: from metis.ext.pengutronix.de ([85.220.165.71]:47615 "EHLO metis.ext.pengutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388107AbfJDUjr (ORCPT ); Fri, 4 Oct 2019 16:39:47 -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 1iGUMQ-00047D-Kn; Fri, 04 Oct 2019 22:39:34 +0200 Received: from ukl by pty.hi.pengutronix.de with local (Exim 4.89) (envelope-from ) id 1iGUMP-0000YC-L0; Fri, 04 Oct 2019 22:39:33 +0200 Date: Fri, 4 Oct 2019 22:39:33 +0200 From: Uwe =?iso-8859-1?Q?Kleine-K=F6nig?= To: Claudiu.Beznea@microchip.com Cc: kamel.bouhara@bootlin.com, wsa@the-dreams.de, linux-i2c@vger.kernel.org, linux-kernel@vger.kernel.org, Nicolas.Ferre@microchip.com, alexandre.belloni@bootlin.com, Ludovic.Desroches@microchip.com, linux-arm-kernel@lists.infradead.org, devicetree@vger.kernel.org, thomas.petazzoni@bootlin.com Subject: Re: [PATCH 2/4] i2c: at91: implement i2c bus recovery Message-ID: <20191004203933.tfhr6cwbsq2hxrov@pengutronix.de> References: <20191002144658.7718-1-kamel.bouhara@bootlin.com> <20191002144658.7718-3-kamel.bouhara@bootlin.com> <08e99a4b-851e-0bee-4c5a-8578b42c283e@microchip.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <08e99a4b-851e-0bee-4c5a-8578b42c283e@microchip.com> 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 On Fri, Oct 04, 2019 at 09:35:23AM +0000, Claudiu.Beznea@microchip.com wrote: > Hi Kamel, > > On 02.10.2019 17:46, Kamel Bouhara wrote: > > +static int at91_init_twi_recovery_info(struct platform_device *pdev, > > + struct at91_twi_dev *dev) > > +{ > > + struct i2c_bus_recovery_info *rinfo = &dev->rinfo; > > + > > + dev->pinctrl = devm_pinctrl_get(&pdev->dev); > > + if (!dev->pinctrl || IS_ERR(dev->pinctrl)) { > > You may use IS_ERR_OR_NULL() here. Can devm_pinctrl_get return NULL? From a quick look, it cannot. rule of thumb: IS_ERR_OR_NULL is wrong as it is a sign of poor return value semantics. Best regards Uwe -- Pengutronix e.K. | Uwe Kleine-König | Industrial Linux Solutions | http://www.pengutronix.de/ | 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 X-Spam-Level: X-Spam-Status: No, score=-2.3 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,USER_AGENT_SANE_1 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2AA8BC47404 for ; Fri, 4 Oct 2019 20:40:04 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id AFF0E215EA for ; Fri, 4 Oct 2019 20:40:03 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="CpC0Bkk1" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org AFF0E215EA Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=pengutronix.de Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; 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=sRp7eOFV4P1gdGBhlQ/+xk+tQJwBj35Ai2X2mlJ/qmM=; b=CpC0Bkk12VgRrq PFidkU/Qz7+9w1zGl0z0X9JEzsSYkYgKJEk865/UEye17CNLxie8yo8sjX8mUnLCGRJgwDFLAX4+B 5qQT9xLhPgfWq952VBMgebWY4wyjJootoS0UnStnNmwkZCeZPMlR8qiqso8oW5z1YMPfFU1qZxuMI ZN2zSBND8a4i3CwdowpYKl+JX3XBjMR/CoxydIZ+ZhnX0jbW7TctctYfbb6SsLSN5Du4XzdvvI9At j4m8zZ5tfCT4mKCRCfNkRfHX0+1qwo+z5OfSjyWYAUJO3dzwquBionXgen6zefF8UUmdpLuezGZzc zu7jWbP06Wy9We7t+cJA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.2 #3 (Red Hat Linux)) id 1iGUMl-0004vA-0A; Fri, 04 Oct 2019 20:39:55 +0000 Received: from metis.ext.pengutronix.de ([2001:67c:670:201:290:27ff:fe1d:cc33]) by bombadil.infradead.org with esmtps (Exim 4.92.2 #3 (Red Hat Linux)) id 1iGUMa-0004ld-4O for linux-arm-kernel@lists.infradead.org; Fri, 04 Oct 2019 20:39:45 +0000 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 1iGUMQ-00047D-Kn; Fri, 04 Oct 2019 22:39:34 +0200 Received: from ukl by pty.hi.pengutronix.de with local (Exim 4.89) (envelope-from ) id 1iGUMP-0000YC-L0; Fri, 04 Oct 2019 22:39:33 +0200 Date: Fri, 4 Oct 2019 22:39:33 +0200 From: Uwe =?iso-8859-1?Q?Kleine-K=F6nig?= To: Claudiu.Beznea@microchip.com Subject: Re: [PATCH 2/4] i2c: at91: implement i2c bus recovery Message-ID: <20191004203933.tfhr6cwbsq2hxrov@pengutronix.de> References: <20191002144658.7718-1-kamel.bouhara@bootlin.com> <20191002144658.7718-3-kamel.bouhara@bootlin.com> <08e99a4b-851e-0bee-4c5a-8578b42c283e@microchip.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <08e99a4b-851e-0bee-4c5a-8578b42c283e@microchip.com> 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-arm-kernel@lists.infradead.org X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20191004_133944_199944_8720E151 X-CRM114-Status: UNSURE ( 9.05 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kamel.bouhara@bootlin.com, alexandre.belloni@bootlin.com, wsa@the-dreams.de, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Ludovic.Desroches@microchip.com, linux-i2c@vger.kernel.org, thomas.petazzoni@bootlin.com, linux-arm-kernel@lists.infradead.org Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Fri, Oct 04, 2019 at 09:35:23AM +0000, Claudiu.Beznea@microchip.com wrot= e: > Hi Kamel, > = > On 02.10.2019 17:46, Kamel Bouhara wrote: > > +static int at91_init_twi_recovery_info(struct platform_device *pdev, > > + struct at91_twi_dev *dev) > > +{ > > + struct i2c_bus_recovery_info *rinfo =3D &dev->rinfo; > > + > > + dev->pinctrl =3D devm_pinctrl_get(&pdev->dev); > > + if (!dev->pinctrl || IS_ERR(dev->pinctrl)) { > = > You may use IS_ERR_OR_NULL() here. Can devm_pinctrl_get return NULL? From a quick look, it cannot. rule of thumb: IS_ERR_OR_NULL is wrong as it is a sign of poor return value semantics. Best regards Uwe -- = Pengutronix e.K. | Uwe Kleine-K=F6nig | Industrial Linux Solutions | http://www.pengutronix.de/ | _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel