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 F3FAEFD4F1D for ; Tue, 10 Mar 2026 18:40:55 +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:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc: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=pQphGvJhHXrNOKnqpKOK0qMMkkSeSzhTl4yrWpLoSx0=; b=o34noH1LLFcA1A 1WgxYX9h+l0Fy8FgJJJUx4VeJaKXMn3zdvU8JMCIVJER6I8uHvtHUwtcUAE7F6bBMwPW8N5VhwzjP mAIi1/+eA8C/GQn9DIb72AP5cAUkCjHxzydwPEUR/t1r88z3MYZBv8aPyQ5V896fYn6mhMCLnojOM c0QlNUrIHh4JchrWagPqhUAwwL0w4Q2uwFxTTxKZDrPptCtLKQrTAxNfqPqPUJB7XGi2FkWKtV6aH zsdMd/2Z+LE1gyfcwZjHdZFyCdrr521uJA9bH+gZLVlC7Kk1X4CH24ab0gMpGl9vBtbF2zpdEvKqJ IsPR/XrpYQtSIAVekCAw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98.2 #2 (Red Hat Linux)) id 1w020l-0000000A6Fq-31Y1; Tue, 10 Mar 2026 18:40:55 +0000 Received: from mail-pl1-x62d.google.com ([2607:f8b0:4864:20::62d]) by bombadil.infradead.org with esmtps (Exim 4.98.2 #2 (Red Hat Linux)) id 1w020h-0000000A6BH-1rNs for linux-phy@lists.infradead.org; Tue, 10 Mar 2026 18:40:54 +0000 Received: by mail-pl1-x62d.google.com with SMTP id d9443c01a7336-2ae82df847bso30023695ad.2 for ; Tue, 10 Mar 2026 11:40:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1773168050; x=1773772850; darn=lists.infradead.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=bjFZ9oZWWc3RZ4UdO5rq+AZbr7uPDX73K58gh1+yuH0=; b=gtLybQfMSjecfKBaGNqaukRn3K/7o8JorJppIKNpCc+QM/VJDFJvQwwbooZQ9FcmwP GCJvFN1msrobA2RnJ6du+aZ+7LE8i6/Pk9CnOufc1FiA/Ls9JTwqbiEwN0GiAlxEDCyW 7H7mM09xEr8SCiQcpLZ64RPaXO8aM0vVmSFf5Iw80b+sAnAm9XsVaGZVzWdCHJWBX+ib /6nxmSb16ClMReUtBFSqlLUtXsyUxp9FlN1rO2Ktv660+THVRNhWB7k87ee+i1sMFwOr JgIovHR0jlAXD5w0qlh76L4y4llZogMns7Q8v4LbegdO35xX29KypZYhSSLLNFLOppEI Cy2w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1773168050; x=1773772850; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-gg:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=bjFZ9oZWWc3RZ4UdO5rq+AZbr7uPDX73K58gh1+yuH0=; b=YGNBe/PuaUUQwuZGxmKLxCE3e1ebzw8yR6t6+/Yx7eqcD2O9iB/yzZDh7KmAUBnIkU bnkK8KHjFxXfNY63VqzHrss3yfuG7akdN+ElBMMk1iDBRsCUNohUKN6eF3siHqhgEp+p sw6fS6HvImXyj5VaHJ0YefxXLpTeoynV0o6qMIqAuPOUFe/IqMaY/MZLgh+je55owj2d NuWC41dLC0ptmN1izSQQroSUoGTrDRVi8+fwJzDyYV2hA+1uf24nqALy5G9c0Z6lOp+f ibOKlpFQUDWh7hwe7vTT0FQwWKlQWnaqO2WK17crUpWN1as0Ow3ojm61puLTlYl6sNpS y0gw== X-Forwarded-Encrypted: i=1; AJvYcCVkHECEO4RwbrBePxBSRgYntQBADgga28iG/p5h3HVO/QfkPF1i3cmeMHqeYtq1Z3ncxxm3/xI92ok=@lists.infradead.org X-Gm-Message-State: AOJu0Ywhl+XmgXyjD9MDVqd6eNSeVP290xg5RHmMtLzesj3pCHeVQfTt Cp4zV6ztpBC8B6m/UXfsljNb6tnWBPPtSF1eDPnqxAJ6spT7eO4l9whQ X-Gm-Gg: ATEYQzzmqwY2N+nWtWyMPy6DrA0WmtFy88jPRZtG67Kze91Zdzzdr1ClnhEb7b/5If7 i+/7gILF7UtrwW1HoLhoP7xUwiOspkUTc2G+HQHZrGSVcbnX87nB6N7x/G4qN4BQ7Tqy8y3P3qj x/tkZwiE0QQm/cQp9KCpOUNaIEVO6C6GYN5++taigODjRPzPlt4B9tOuJVifceFhKel9zoodggT ntdjeaGkDli9MzMNFE+4u+1JsD5/0h4mVwnI5xCxXOvGDd5V5xR75LL1mGaEVa0G1m0STigYoB8 Wr8JMJYIrUGR65ZzIQSm7HldOcIo3XyISol5KZ5rtQhXX8vA8ZVJA+0+URjVKTo9sobVI0H/4yq PUJcTlrA7iLjAQ3JIB2V8kt3x/V75z+HnhdXKInVChz9a4qX5FcV/8MWvp4R/YJdDM/z/wVVzu7 1mbi3Ap8BNbQSFEdS7z7ZRyJFmNvegJwoR9HomSr8YV76p8Q== X-Received: by 2002:a17:903:28c8:b0:2ae:5671:7071 with SMTP id d9443c01a7336-2ae8252cf0fmr96662285ad.43.1773168050081; Tue, 10 Mar 2026 11:40:50 -0700 (PDT) Received: from google.com ([2402:7500:a44:85b:2953:97d3:b283:95c3]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-2ae83e58592sm220535625ad.14.2026.03.10.11.40.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Mar 2026 11:40:49 -0700 (PDT) Date: Wed, 11 Mar 2026 02:40:36 +0800 From: Kuan-Wei Chiu To: Philipp Hahn Cc: amd-gfx@lists.freedesktop.org, apparmor@lists.ubuntu.com, bpf@vger.kernel.org, ceph-devel@vger.kernel.org, cocci@inria.fr, dm-devel@lists.linux.dev, dri-devel@lists.freedesktop.org, gfs2@lists.linux.dev, intel-gfx@lists.freedesktop.org, intel-wired-lan@lists.osuosl.org, iommu@lists.linux.dev, kvm@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-block@vger.kernel.org, linux-bluetooth@vger.kernel.org, linux-btrfs@vger.kernel.org, linux-cifs@vger.kernel.org, linux-clk@vger.kernel.org, linux-erofs@lists.ozlabs.org, linux-ext4@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-gpio@vger.kernel.org, linux-hyperv@vger.kernel.org, linux-input@vger.kernel.org, linux-kernel@vger.kernel.org, linux-leds@vger.kernel.org, linux-media@vger.kernel.org, linux-mips@vger.kernel.org, linux-mm@kvack.org, linux-modules@vger.kernel.org, linux-mtd@lists.infradead.org, linux-nfs@vger.kernel.org, linux-omap@vger.kernel.org, linux-phy@lists.infradead.org, linux-pm@vger.kernel.org, linux-rockchip@lists.infradead.org, linux-s390@vger.kernel.org, linux-scsi@vger.kernel.org, linux-sctp@vger.kernel.org, linux-security-module@vger.kernel.org, linux-sh@vger.kernel.org, linux-sound@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, linux-trace-kernel@vger.kernel.org, linux-usb@vger.kernel.org, linux-wireless@vger.kernel.org, netdev@vger.kernel.org, ntfs3@lists.linux.dev, samba-technical@lists.samba.org, sched-ext@lists.linux.dev, target-devel@vger.kernel.org, tipc-discussion@lists.sourceforge.net, v9fs@lists.linux.dev Subject: Re: [PATCH 00/61] treewide: Use IS_ERR_OR_NULL over manual NULL check - refactor Message-ID: References: <20260310-b4-is_err_or_null-v1-0-bd63b656022d@avm.de> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20260310-b4-is_err_or_null-v1-0-bd63b656022d@avm.de> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20260310_114051_514521_D3FBB68D X-CRM114-Status: GOOD ( 16.62 ) X-BeenThere: linux-phy@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Linux Phy Mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-phy" Errors-To: linux-phy-bounces+linux-phy=archiver.kernel.org@lists.infradead.org Hi Philipp, On Tue, Mar 10, 2026 at 12:48:26PM +0100, Philipp Hahn wrote: > While doing some static code analysis I stumbled over a common pattern, > where IS_ERR() is combined with a NULL check. For that there is > IS_ERR_OR_NULL(). > > I've written a Coccinelle patch to find and patch those instances. > The patches follow grouped by subsystem. > > Patches 55-58 may be dropped as they have a (minor?) semantic change: > They use WARN_ON() or WARN_ON_ONCE(), but only in the IS_ERR() path, not > for the NULL check. Iff it is okay to print the warning also for NULL, > then the patches can be applied. > > While generating the patch set `checkpatch` complained about mixing > [un]likely() with IS_ERR_OR_NULL(), which already uses likely() > internally. I found and fixed several locations, where that combination > has been used. Thanks for the patchset. However, I think we need a explanation for why switching to IS_ERR_OR_NULL() is an improvement over the existing code. IMHO, the necessity of IS_ERR_OR_NULL() often highlights a confusing or flawed API design. It usually implies that the caller is unsure whether a failure results in an error pointer or a NULL pointer. Rather than doing a treewide conversion of this pattern, I believe it would be much more meaningful to review these instances case-by-case and fix the underlying APIs or caller logic instead. Additionally, a treewide refactoring like this has the practical drawback of creating unnecessary merge conflicts when backporting to stable trees. Regards, Kuan-Wei -- linux-phy mailing list linux-phy@lists.infradead.org https://lists.infradead.org/mailman/listinfo/linux-phy