All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/3] checkpatch: Add devres_alloc() to allocation functions
@ 2026-08-12  4:28 phucduc.bui
  2026-08-12  4:28 ` [PATCH 2/3] thermal: hwmon: Remove redundant OOM message phucduc.bui
  2026-08-12  4:28 ` [PATCH 3/3] usb: phy: " phucduc.bui
  0 siblings, 2 replies; 3+ messages in thread
From: phucduc.bui @ 2026-08-12  4:28 UTC (permalink / raw)
  To: Andy Whitcroft, Joe Perches, rafael, Daniel Lezcano, Zhang Rui,
	Lukasz Luba, Greg Kroah-Hartman, Diogo Ivo, linux-pm,
	linux-kernel, linux-usb
  Cc: bui duc phuc

From: bui duc phuc <phucduc.bui@gmail.com>

Add devres_alloc() and devres_alloc_node() to $allocFunctions so
checkpatch.pl can detect unnecessary out-of-memory messages
following a failed allocation.

Signed-off-by: bui duc phuc <phucduc.bui@gmail.com>
---

Link v1: 
https://lore.kernel.org/all/20260812024304.9350-1-phucduc.bui@gmail.com/
Changes in v2:
 - Add devres_alloc_node() to $allocFunctions.
 - Update the commit message.

 scripts/checkpatch.pl | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index 2b7a42bbdd94..e89cbc3f2604 100755
--- 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(?:_node)?
 )};
 
 our $signature_tags = qr{(?xi:
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [PATCH 2/3] thermal: hwmon: Remove redundant OOM message
  2026-08-12  4:28 [PATCH 1/3] checkpatch: Add devres_alloc() to allocation functions phucduc.bui
@ 2026-08-12  4:28 ` phucduc.bui
  2026-08-12  4:28 ` [PATCH 3/3] usb: phy: " phucduc.bui
  1 sibling, 0 replies; 3+ messages in thread
From: phucduc.bui @ 2026-08-12  4:28 UTC (permalink / raw)
  To: Andy Whitcroft, Joe Perches, rafael, Daniel Lezcano, Zhang Rui,
	Lukasz Luba, Greg Kroah-Hartman, Diogo Ivo, linux-pm,
	linux-kernel, linux-usb
  Cc: bui duc phuc

From: bui duc phuc <phucduc.bui@gmail.com>

Remove the dev_warn() after a failed devres_alloc(). This is
consistent with checkpatch's OOM_MESSAGE convention: no error
message is needed after a kzalloc()-style allocation failure.

Signed-off-by: bui duc phuc <phucduc.bui@gmail.com>
---
 drivers/thermal/thermal_hwmon.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/thermal/thermal_hwmon.c b/drivers/thermal/thermal_hwmon.c
index ec73d03a1e60..747ac87d1c37 100644
--- a/drivers/thermal/thermal_hwmon.c
+++ b/drivers/thermal/thermal_hwmon.c
@@ -269,10 +269,8 @@ int devm_thermal_add_hwmon_sysfs(struct device *dev, struct thermal_zone_device
 
 	ptr = devres_alloc(devm_thermal_hwmon_release, sizeof(*ptr),
 			   GFP_KERNEL);
-	if (!ptr) {
-		dev_warn(dev, "Failed to allocate device resource data\n");
+	if (!ptr)
 		return -ENOMEM;
-	}
 
 	ret = thermal_add_hwmon_sysfs(tz);
 	if (ret) {
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [PATCH 3/3] usb: phy: Remove redundant OOM message
  2026-08-12  4:28 [PATCH 1/3] checkpatch: Add devres_alloc() to allocation functions phucduc.bui
  2026-08-12  4:28 ` [PATCH 2/3] thermal: hwmon: Remove redundant OOM message phucduc.bui
@ 2026-08-12  4:28 ` phucduc.bui
  1 sibling, 0 replies; 3+ messages in thread
From: phucduc.bui @ 2026-08-12  4:28 UTC (permalink / raw)
  To: Andy Whitcroft, Joe Perches, rafael, Daniel Lezcano, Zhang Rui,
	Lukasz Luba, Greg Kroah-Hartman, Diogo Ivo, linux-pm,
	linux-kernel, linux-usb
  Cc: bui duc phuc

From: bui duc phuc <phucduc.bui@gmail.com>

Remove the dev_dbg() after a failed devres_alloc(). This is
consistent with checkpatch's OOM_MESSAGE convention: no error
message is needed after a kzalloc()-style allocation failure.

Signed-off-by: bui duc phuc <phucduc.bui@gmail.com>
---
 drivers/usb/phy/phy.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/usb/phy/phy.c b/drivers/usb/phy/phy.c
index 5a9b9353f343..117a33fa9e91 100644
--- a/drivers/usb/phy/phy.c
+++ b/drivers/usb/phy/phy.c
@@ -534,10 +534,8 @@ struct  usb_phy *devm_usb_get_phy_by_node(struct device *dev,
 	unsigned long	flags;
 
 	ptr = devres_alloc(devm_usb_phy_release2, sizeof(*ptr), GFP_KERNEL);
-	if (!ptr) {
-		dev_dbg(dev, "failed to allocate memory for devres\n");
+	if (!ptr)
 		goto err0;
-	}
 
 	spin_lock_irqsave(&phy_lock, flags);
 
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-08-12  4:29 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-08-12  4:28 [PATCH 1/3] checkpatch: Add devres_alloc() to allocation functions phucduc.bui
2026-08-12  4:28 ` [PATCH 2/3] thermal: hwmon: Remove redundant OOM message phucduc.bui
2026-08-12  4:28 ` [PATCH 3/3] usb: phy: " phucduc.bui

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.