From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 66535319601; Fri, 19 Sep 2025 16:54:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1758300884; cv=none; b=hfuI/HT10PRrCRMftAITxHo3moRVLS1xfzD4DoMEgzuNkYWK6Dh+oAXXxQ2heFv0rkNoXVloU68kmRN7Zkm5OLIiB1PnGWBxgSPM/9H/eFxRH5tzrAuC7N7UG1gLwR0ta39mqYLmFTVPmKGvck6iniUJltL43KsrOiZ5xK0IQBw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1758300884; c=relaxed/simple; bh=NZu0V+WzD5N8m0SVaI1EL9lbDRhIMMw5OUDb/otoK1c=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=XhxtsKC6KG0s+2pRpGofZl8ejYYkOK8SjRHegGJ9cMQ7GkALFYdSgmDDFCa3m5rLQWBIc8ZFkkpR8+MEX1Ic9e38oSWU1R6Ml8xzU4v81u1HA3U5qDDwl1/8UlqIQHHSD7VNqQfZYe3llpSRmPA2gpxfhIV+Y13qqAFaWZ04glQ= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=C3bgr892; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="C3bgr892" Received: by smtp.kernel.org (Postfix) with ESMTPSA id CC430C4CEF7; Fri, 19 Sep 2025 16:54:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1758300884; bh=NZu0V+WzD5N8m0SVaI1EL9lbDRhIMMw5OUDb/otoK1c=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=C3bgr892RrzxJ5WoKTjd1JfSCJE9KwluV/MOD7kt7TvFEv18k+ldcL84ehHnA7odE HaWuQaYt3DssBQ7S08c8BRabe68Q4BfWmDwwTcBegvru694XVdXgxThV27MGxGUYNU nUcfXj/kwsHnYFDIjxo1xZTGqSPUgB5bhhumvMv6OdBZbnR+LpXqQFIaEIJM8puH2G 8uXMtZ8/gOw1L4K+0ATQHQlVELlg7Q23FExHdhRN+05k+KWH68ZFQubO+p3FULj+P0 i1Ed4SEeERoN6+ZVgtMoHs0ZTuptCQ6m6uoKyWX2R7/AlwscIDhG67diTgNtiGIH5Q CgzhmruGwYB/w== Date: Fri, 19 Sep 2025 17:54:38 +0100 From: Simon Horman To: Tariq Toukan Cc: Eric Dumazet , Jakub Kicinski , Paolo Abeni , Andrew Lunn , "David S. Miller" , Saeed Mahameed , Leon Romanovsky , Mark Bloch , Julia Lawall , Nicolas Palix , Richard Cochran , linux-kernel@vger.kernel.org, netdev@vger.kernel.org, linux-rdma@vger.kernel.org, cocci@inria.fr, Gal Pressman Subject: Re: [PATCH net-next 1/2] scripts/coccinelle: Find PTR_ERR() to %pe candidates Message-ID: <20250919165438.GB589507@horms.kernel.org> References: <1758192227-701925-1-git-send-email-tariqt@nvidia.com> <1758192227-701925-2-git-send-email-tariqt@nvidia.com> Precedence: bulk X-Mailing-List: linux-rdma@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1758192227-701925-2-git-send-email-tariqt@nvidia.com> On Thu, Sep 18, 2025 at 01:43:46PM +0300, Tariq Toukan wrote: > From: Gal Pressman > > Add a new Coccinelle script to identify places where PTR_ERR() is used > in print functions and suggest using the %pe format specifier instead. > > For printing error pointers (i.e., a pointer for which IS_ERR() is true) > %pe will print a symbolic error name (e.g,. -EINVAL), opposed to the raw > errno (e.g,. -22) produced by PTR_ERR(). > It also makes the code cleaner by saving a redundant call to PTR_ERR(). > > The script supports context, report, and org modes. > > Example transformation: > printk("Error: %ld\n", PTR_ERR(ptr)); // Before > printk("Error: %pe\n", ptr); // After > > Signed-off-by: Gal Pressman > Reviewed-by: Alexei Lazar > Signed-off-by: Tariq Toukan Thanks, having this check seems very nice to me. Reviewed-by: Simon Horman