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=-4.0 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS 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 89853C33C99 for ; Tue, 7 Jan 2020 05:16:27 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (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 2E75A207FD for ; Tue, 7 Jan 2020 05:16:26 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=alsa-project.org header.i=@alsa-project.org header.b="OzYvzzk6"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=kernel.org header.i=@kernel.org header.b="dnpAH75A" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 2E75A207FD Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=alsa-devel-bounces@alsa-project.org Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 6174F17E9; Tue, 7 Jan 2020 06:15:34 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 6174F17E9 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1578374184; bh=uRsQU20dXr9XJfjNZo39iVh9Fj4FrQNIDlMrXPCDvVQ=; h=Date:From:To:References:In-Reply-To:Cc:Subject:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=OzYvzzk6XSmm1Phgz8HRtauO8hhf131aPoMRkuorxaatpzBUhBygASQMghjgUIY2R CkgHd3FTG3VuC7DCRubDDwS+k2UZI4SkaQMJclymgCEYMdOM23ovMXiOQlE8FYL7+g gKByQS5lRLn1w2d4wa6O64WknQnJUa55ete81+7M= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id C824CF80140; Tue, 7 Jan 2020 06:15:33 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id AB6C0F8014A; Tue, 7 Jan 2020 06:15:31 +0100 (CET) Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 60583F8010B for ; Tue, 7 Jan 2020 06:15:27 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 60583F8010B Authentication-Results: alsa1.perex.cz; dkim=pass (1024-bit key) header.d=kernel.org header.i=@kernel.org header.b="dnpAH75A" Received: from sol.localdomain (c-24-5-143-220.hsd1.ca.comcast.net [24.5.143.220]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 214E7207FD; Tue, 7 Jan 2020 05:15:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1578374124; bh=7IRn73LOcIxtOPF38vt+jdde9KSqRJ/hkO43TQ+PV6U=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=dnpAH75AkRY/1sigQosliNYb44fjXUGI2Xe+Dafae7NTasmhJWZx+xPPtruGzof9z ekmuxXw3RYrNLLwaqyFrIQ2MDeGdHqUhMO/aBvrxvBjJb4RYfgduqd6DFtDSNZ7i++ Gt/q+ebKKUIWAqAO7XQIDe03Tvpx6CNDuA2Yb8dk= Date: Mon, 6 Jan 2020 21:15:21 -0800 From: Eric Biggers To: Masahiro Yamada Message-ID: <20200107051521.GF705@sol.localdomain> References: <20200106045833.1725-1-masahiroy@kernel.org> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20200106045833.1725-1-masahiroy@kernel.org> Cc: devicetree@vger.kernel.org, alsa-devel@alsa-project.org, linux-acpi@vger.kernel.org, netdev@vger.kernel.org, linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org, Julia Lawall , linux-mtd@lists.infradead.org, linux-crypto@vger.kernel.org, Andrew Morton , linux-clk@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-i2c@vger.kernel.org Subject: Re: [alsa-devel] [PATCH] treewide: remove redundent IS_ERR() before error code check X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" On Mon, Jan 06, 2020 at 01:58:33PM +0900, Masahiro Yamada wrote: > 'PTR_ERR(p) == -E*' is a stronger condition than IS_ERR(p). > Hence, IS_ERR(p) is unneeded. > > The semantic patch that generates this commit is as follows: > > // > @@ > expression ptr; > constant error_code; > @@ > -IS_ERR(ptr) && (PTR_ERR(ptr) == - error_code) > +PTR_ERR(ptr) == - error_code > // > > Signed-off-by: Masahiro Yamada Any reason for not doing instead: ptr == ERR_PTR(-error_code) ? To me it seems weird to use PTR_ERR() on non-error pointers. I even had to double check that it returns a 'long' and not an 'int'. (If it returned an 'int', it wouldn't work...) - Eric _______________________________________________ Alsa-devel mailing list Alsa-devel@alsa-project.org https://mailman.alsa-project.org/mailman/listinfo/alsa-devel 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=-4.1 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE, SPF_PASS 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 415F5C33C9B for ; Tue, 7 Jan 2020 05:15:26 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 1811F207FF for ; Tue, 7 Jan 2020 05:15:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1578374126; bh=7IRn73LOcIxtOPF38vt+jdde9KSqRJ/hkO43TQ+PV6U=; h=Date:From:To:Cc:Subject:References:In-Reply-To:List-ID:From; b=leRuA8SGl8yvm+1DsHYY/x3MPDKD9Yzplm3Yx7Sr0lL2DOIH2cBBXmTqqZUilDXyp 1hu8zM4TyRsHzL+Vrc/oKvGiAh4fBM+AUtV8tpqcZABwtIKNvxg0MnXGVUEXBJXQwX qFFcOUzYE7qMGdf7E2tcj+Wx9/6aIve0KtAnCgXQ= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725874AbgAGFPZ (ORCPT ); Tue, 7 Jan 2020 00:15:25 -0500 Received: from mail.kernel.org ([198.145.29.99]:39250 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725267AbgAGFPZ (ORCPT ); Tue, 7 Jan 2020 00:15:25 -0500 Received: from sol.localdomain (c-24-5-143-220.hsd1.ca.comcast.net [24.5.143.220]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 214E7207FD; Tue, 7 Jan 2020 05:15:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1578374124; bh=7IRn73LOcIxtOPF38vt+jdde9KSqRJ/hkO43TQ+PV6U=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=dnpAH75AkRY/1sigQosliNYb44fjXUGI2Xe+Dafae7NTasmhJWZx+xPPtruGzof9z ekmuxXw3RYrNLLwaqyFrIQ2MDeGdHqUhMO/aBvrxvBjJb4RYfgduqd6DFtDSNZ7i++ Gt/q+ebKKUIWAqAO7XQIDe03Tvpx6CNDuA2Yb8dk= Date: Mon, 6 Jan 2020 21:15:21 -0800 From: Eric Biggers To: Masahiro Yamada Cc: Andrew Morton , Julia Lawall , linux-acpi@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-clk@vger.kernel.org, linux-crypto@vger.kernel.org, linux-gpio@vger.kernel.org, linux-i2c@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mtd@lists.infradead.org, netdev@vger.kernel.org, alsa-devel@alsa-project.org, devicetree@vger.kernel.org Subject: Re: [PATCH] treewide: remove redundent IS_ERR() before error code check Message-ID: <20200107051521.GF705@sol.localdomain> References: <20200106045833.1725-1-masahiroy@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200106045833.1725-1-masahiroy@kernel.org> Sender: linux-acpi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org On Mon, Jan 06, 2020 at 01:58:33PM +0900, Masahiro Yamada wrote: > 'PTR_ERR(p) == -E*' is a stronger condition than IS_ERR(p). > Hence, IS_ERR(p) is unneeded. > > The semantic patch that generates this commit is as follows: > > // > @@ > expression ptr; > constant error_code; > @@ > -IS_ERR(ptr) && (PTR_ERR(ptr) == - error_code) > +PTR_ERR(ptr) == - error_code > // > > Signed-off-by: Masahiro Yamada Any reason for not doing instead: ptr == ERR_PTR(-error_code) ? To me it seems weird to use PTR_ERR() on non-error pointers. I even had to double check that it returns a 'long' and not an 'int'. (If it returned an 'int', it wouldn't work...) - Eric 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=-4.0 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS 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 3DCD3C33C99 for ; Tue, 7 Jan 2020 05:15:51 +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 07A202072A for ; Tue, 7 Jan 2020 05:15:51 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="mY2H1mTj"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=kernel.org header.i=@kernel.org header.b="dnpAH75A" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 07A202072A Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-mtd-bounces+linux-mtd=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=OzkktswrbqKR7osOf2xGzK3QpNCElBwLvrqVHS0Evww=; b=mY2H1mTjFA4yIv GtKGT72TgUvcmulb8QAcdL7P7iOAhaT/zjrNe3doWWj8pMuDyQflFw/vCCZW2IjyzQkxwSqbmcFah Io50haVsX4XjQgFjUq8megSoeP8W+dMYDfACrYKfEFENv3Qnwwo+QM5urJ3GoLFhxgkJZHYHHD2dZ rZIMoeMhWPil73z/VdM+GTEkkTKra5r0aWdkt53ypgQEh7sDBxEliJ7WNiVDBRqfLxI5i7dSUOx9A E+dfdIkZA832kE5HwVddPBkynAtZdqWjsPjit8aNZgOCeJA83N/yggEqdSkZQccFDtms92E1xXeFq bfN5DjmPeG3R47eUNThA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1iohDM-0001DH-QS; Tue, 07 Jan 2020 05:15:36 +0000 Received: from mail.kernel.org ([198.145.29.99]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1iohDC-00015P-Io; Tue, 07 Jan 2020 05:15:27 +0000 Received: from sol.localdomain (c-24-5-143-220.hsd1.ca.comcast.net [24.5.143.220]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 214E7207FD; Tue, 7 Jan 2020 05:15:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1578374124; bh=7IRn73LOcIxtOPF38vt+jdde9KSqRJ/hkO43TQ+PV6U=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=dnpAH75AkRY/1sigQosliNYb44fjXUGI2Xe+Dafae7NTasmhJWZx+xPPtruGzof9z ekmuxXw3RYrNLLwaqyFrIQ2MDeGdHqUhMO/aBvrxvBjJb4RYfgduqd6DFtDSNZ7i++ Gt/q+ebKKUIWAqAO7XQIDe03Tvpx6CNDuA2Yb8dk= Date: Mon, 6 Jan 2020 21:15:21 -0800 From: Eric Biggers To: Masahiro Yamada Subject: Re: [PATCH] treewide: remove redundent IS_ERR() before error code check Message-ID: <20200107051521.GF705@sol.localdomain> References: <20200106045833.1725-1-masahiroy@kernel.org> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20200106045833.1725-1-masahiroy@kernel.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200106_211526_646748_956AB784 X-CRM114-Status: UNSURE ( 8.70 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-mtd@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux MTD discussion mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: devicetree@vger.kernel.org, alsa-devel@alsa-project.org, linux-acpi@vger.kernel.org, netdev@vger.kernel.org, linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org, Julia Lawall , linux-mtd@lists.infradead.org, linux-crypto@vger.kernel.org, Andrew Morton , linux-clk@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-i2c@vger.kernel.org Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-mtd" Errors-To: linux-mtd-bounces+linux-mtd=archiver.kernel.org@lists.infradead.org On Mon, Jan 06, 2020 at 01:58:33PM +0900, Masahiro Yamada wrote: > 'PTR_ERR(p) == -E*' is a stronger condition than IS_ERR(p). > Hence, IS_ERR(p) is unneeded. > > The semantic patch that generates this commit is as follows: > > // > @@ > expression ptr; > constant error_code; > @@ > -IS_ERR(ptr) && (PTR_ERR(ptr) == - error_code) > +PTR_ERR(ptr) == - error_code > // > > Signed-off-by: Masahiro Yamada Any reason for not doing instead: ptr == ERR_PTR(-error_code) ? To me it seems weird to use PTR_ERR() on non-error pointers. I even had to double check that it returns a 'long' and not an 'int'. (If it returned an 'int', it wouldn't work...) - Eric ______________________________________________________ Linux MTD discussion mailing list http://lists.infradead.org/mailman/listinfo/linux-mtd/ 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=-4.0 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS 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 02CF2C33C99 for ; Tue, 7 Jan 2020 05:15:38 +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 CDF13207FD for ; Tue, 7 Jan 2020 05:15:37 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="jDPS7gjF"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=kernel.org header.i=@kernel.org header.b="dnpAH75A" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org CDF13207FD Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org 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=QQV1HXcKh+Tn2k1suCNkn3rD9uQF8w8qR9WLRu+3V58=; b=jDPS7gjF3GqhPu xX46vd18d6fY4j0xeZ7uytmankhxC0Xt958Ejbz1w0XIS4M/k7qcXQJTgiEvikLCJIZONn5kfkqKc 6Mk46VSlFrsCIUxhLElmEMFeq+zC0cpAQpIVL75HC5dXdnQcmYFNjfAKHGm4BMVgeIGgmwbRhvqKW 0KUpBog10eB9cfaOgnqFbMK2/GZk3FZIG92KlGTYkAdrLSbyTHnt6uRNDRtU0D1xTTmov4IoXY1an G2WQKc9HSU3PBvVjyL0p7TVKv0JGRkFY4GxY0DqDf/C4MODAG1WU2pfi6kZ3bn281dcCn/TYli7DN ZvSotMaicTPPo9LbrKMQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1iohDG-00016e-0k; Tue, 07 Jan 2020 05:15:30 +0000 Received: from mail.kernel.org ([198.145.29.99]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1iohDC-00015P-Io; Tue, 07 Jan 2020 05:15:27 +0000 Received: from sol.localdomain (c-24-5-143-220.hsd1.ca.comcast.net [24.5.143.220]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 214E7207FD; Tue, 7 Jan 2020 05:15:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1578374124; bh=7IRn73LOcIxtOPF38vt+jdde9KSqRJ/hkO43TQ+PV6U=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=dnpAH75AkRY/1sigQosliNYb44fjXUGI2Xe+Dafae7NTasmhJWZx+xPPtruGzof9z ekmuxXw3RYrNLLwaqyFrIQ2MDeGdHqUhMO/aBvrxvBjJb4RYfgduqd6DFtDSNZ7i++ Gt/q+ebKKUIWAqAO7XQIDe03Tvpx6CNDuA2Yb8dk= Date: Mon, 6 Jan 2020 21:15:21 -0800 From: Eric Biggers To: Masahiro Yamada Subject: Re: [PATCH] treewide: remove redundent IS_ERR() before error code check Message-ID: <20200107051521.GF705@sol.localdomain> References: <20200106045833.1725-1-masahiroy@kernel.org> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20200106045833.1725-1-masahiroy@kernel.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200106_211526_646748_956AB784 X-CRM114-Status: UNSURE ( 8.70 ) 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: devicetree@vger.kernel.org, alsa-devel@alsa-project.org, linux-acpi@vger.kernel.org, netdev@vger.kernel.org, linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org, Julia Lawall , linux-mtd@lists.infradead.org, linux-crypto@vger.kernel.org, Andrew Morton , linux-clk@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-i2c@vger.kernel.org Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Mon, Jan 06, 2020 at 01:58:33PM +0900, Masahiro Yamada wrote: > 'PTR_ERR(p) == -E*' is a stronger condition than IS_ERR(p). > Hence, IS_ERR(p) is unneeded. > > The semantic patch that generates this commit is as follows: > > // > @@ > expression ptr; > constant error_code; > @@ > -IS_ERR(ptr) && (PTR_ERR(ptr) == - error_code) > +PTR_ERR(ptr) == - error_code > // > > Signed-off-by: Masahiro Yamada Any reason for not doing instead: ptr == ERR_PTR(-error_code) ? To me it seems weird to use PTR_ERR() on non-error pointers. I even had to double check that it returns a 'long' and not an 'int'. (If it returned an 'int', it wouldn't work...) - Eric _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel