From: Joe Perches <joe@perches.com>
To: phucduc.bui@gmail.com, Andy Whitcroft <apw@canonical.com>,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] checkpatch: Add devres_alloc() to allocation functions
Date: Tue, 11 Aug 2026 19:55:06 -0700 [thread overview]
Message-ID: <2c012201fdb725852c8b00bed1eb135762f47981.camel@perches.com> (raw)
In-Reply-To: <20260812024304.9350-1-phucduc.bui@gmail.com>
On Wed, 2026-08-12 at 09:43 +0700, phucduc.bui@gmail.com wrote:
> Add devres_alloc() to $allocFunctions so checkpatch.pl can detect
> unnecessary out-of-memory messages following a failed allocation.
OK, are you also updating the 2 existing instances where
there is an OOM message?
-----------
drivers/thermal/thermal_hwmon.c: ptr = devres_alloc(devm_thermal_hwmon_release, sizeof(*ptr),
drivers/thermal/thermal_hwmon.c- GFP_KERNEL);
drivers/thermal/thermal_hwmon.c- if (!ptr) {
drivers/thermal/thermal_hwmon.c- dev_warn(dev, "Failed to allocate device resource data\n");
drivers/thermal/thermal_hwmon.c- return -ENOMEM;
drivers/thermal/thermal_hwmon.c- }
-----------
drivers/usb/phy/phy.c: ptr = devres_alloc(devm_usb_phy_release2, sizeof(*ptr), GFP_KERNEL);
drivers/usb/phy/phy.c- if (!ptr) {
drivers/usb/phy/phy.c- dev_dbg(dev, "failed to allocate memory for devres\n");
drivers/usb/phy/phy.c- goto err0;
drivers/usb/phy/phy.c- }
-----------
What about devres_alloc_node? (there aren't any OOM messages)
> diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
[]
> @@ -644,7 +644,8 @@ our $allocFunctions = qr{(?x:
> kmemdup(?:_nul)?) |
> (?:\w+)?alloc_skb(?:_ip_align)? |
> # dev_alloc_skb/netdev_alloc_skb, et al
> - dma_alloc_coherent
> + dma_alloc_coherent |
> + devres_alloc
> )};
>
> our $signature_tags = qr{(?xi:
next prev parent reply other threads:[~2026-08-12 2:55 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-12 2:43 phucduc.bui
2026-08-12 2:55 ` Joe Perches [this message]
2026-08-12 3:51 ` Bui Duc Phuc
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=2c012201fdb725852c8b00bed1eb135762f47981.camel@perches.com \
--to=joe@perches.com \
--cc=apw@canonical.com \
--cc=linux-kernel@vger.kernel.org \
--cc=phucduc.bui@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®