From: Markus Elfring <elfring(a)users.sourceforge.net>
Date: Sat, 14 Mar 2026 16:00:20 +0100
The device's last busy timestamp was set in a wrapper function since
the commit 18c1fe53d186867243f4cf17f4eef60737a16c4c ("PM: runtime:
Mark last busy stamp in pm_request_autosuspend()").
Thus delete a pm_runtime_mark_last_busy() call before
two pm_request_autosuspend() calls.
The source code was transformed by using the Coccinelle software.
Signed-off-by: Markus Elfring <elfring(a)users.sourceforge.net>
---
drivers/greybus/bundle.c | 1 -
drivers/greybus/interface.c | 1 -
2 files changed, 2 deletions(-)
diff --git a/drivers/greybus/bundle.c b/drivers/greybus/bundle.c
index d1831d0986e9..d8d8e9ba7869 100644
--- a/drivers/greybus/bundle.c
+++ b/drivers/greybus/bundle.c
@@ -155,7 +155,6 @@ static int gb_bundle_resume(struct device *dev)
static int gb_bundle_idle(struct device *dev)
{
- pm_runtime_mark_last_busy(dev);
pm_request_autosuspend(dev);
return 0;
diff --git a/drivers/greybus/interface.c b/drivers/greybus/interface.c
index 4ee4bda4a267..ed56f90369d1 100644
--- a/drivers/greybus/interface.c
+++ b/drivers/greybus/interface.c
@@ -753,7 +753,6 @@ static int gb_interface_resume(struct device *dev)
static int gb_interface_runtime_idle(struct device *dev)
{
- pm_runtime_mark_last_busy(dev);
pm_request_autosuspend(dev);
return 0;
--
2.53.0
From: Markus Elfring <elfring(a)users.sourceforge.net>
Date: Sat, 14 Mar 2026 15:35:09 +0100
The device's last busy timestamp was set in a wrapper function since
the commit 18c1fe53d186867243f4cf17f4eef60737a16c4c ("PM: runtime:
Mark last busy stamp in pm_request_autosuspend()").
Thus delete a pm_runtime_mark_last_busy() call before
a pm_request_autosuspend() call.
The source code was transformed by using the Coccinelle software.
Signed-off-by: Markus Elfring <elfring(a)users.sourceforge.net>
---
drivers/staging/greybus/gbphy.c | 1 -
1 file changed, 1 deletion(-)
diff --git a/drivers/staging/greybus/gbphy.c b/drivers/staging/greybus/gbphy.c
index bdb0f5164a6f..949656e75e8b 100644
--- a/drivers/staging/greybus/gbphy.c
+++ b/drivers/staging/greybus/gbphy.c
@@ -53,7 +53,6 @@ static void gbphy_dev_release(struct device *dev)
#ifdef CONFIG_PM
static int gb_gbphy_idle(struct device *dev)
{
- pm_runtime_mark_last_busy(dev);
pm_request_autosuspend(dev);
return 0;
}
--
2.53.0
Driver core holds a reference to the USB interface and its parent USB
device while the interface is bound to a driver and there is no need to
take additional references unless the structures are needed after
disconnect.
Drop the redundant device reference to reduce cargo culting, make it
easier to spot drivers where an extra reference is needed, and reduce
the risk of memory leaks when drivers fail to release it.
Signed-off-by: Johan Hovold <johan(a)kernel.org>
---
This one needs one more spin... Sorry about the mess up.
Johan
Changes in v3:
- drop the leftover usb_dev_put() in early error paths
Changes in v2:
- drop temporary udev variable as reported by the kernel test robot
(W=1 warning)
drivers/greybus/es2.c | 11 ++---------
1 file changed, 2 insertions(+), 9 deletions(-)
diff --git a/drivers/greybus/es2.c b/drivers/greybus/es2.c
index 6ae0ac828afa..75b889fa21b4 100644
--- a/drivers/greybus/es2.c
+++ b/drivers/greybus/es2.c
@@ -772,7 +772,6 @@ static int check_urb_status(struct urb *urb)
static void es2_destroy(struct es2_ap_dev *es2)
{
- struct usb_device *udev;
struct urb *urb;
int i;
@@ -804,10 +803,7 @@ static void es2_destroy(struct es2_ap_dev *es2)
gb_hd_cport_release_reserved(es2->hd, ES2_CPORT_CDSI1);
gb_hd_cport_release_reserved(es2->hd, ES2_CPORT_CDSI0);
- udev = es2->usb_dev;
gb_hd_put(es2->hd);
-
- usb_put_dev(udev);
}
static void cport_in_callback(struct urb *urb)
@@ -1257,11 +1253,10 @@ static int ap_probe(struct usb_interface *interface,
bool bulk_in_found = false;
bool arpc_in_found = false;
- udev = usb_get_dev(interface_to_usbdev(interface));
+ udev = interface_to_usbdev(interface);
num_cports = apb_get_cport_count(udev);
if (num_cports < 0) {
- usb_put_dev(udev);
dev_err(&udev->dev, "Cannot retrieve CPort count: %d\n",
num_cports);
return num_cports;
@@ -1269,10 +1264,8 @@ static int ap_probe(struct usb_interface *interface,
hd = gb_hd_create(&es2_driver, &udev->dev, ES2_GBUF_MSG_SIZE_MAX,
num_cports);
- if (IS_ERR(hd)) {
- usb_put_dev(udev);
+ if (IS_ERR(hd))
return PTR_ERR(hd);
- }
es2 = hd_to_es2(hd);
es2->hd = hd;
--
2.52.0
From: Sanjay Chitroda <sanjayembeddedse(a)gmail.com>
Hi all,
This patch series replaces manual cleanup and explicit kfree() calls with
the __free attribute from <linux/cleanup.h>. This modernizes the memory
management style and simplifies common error paths without altering any
functional behavior.
The __free attribute provides automatic scope-based cleanup, making
resource management clearer and reducing the chances of missing cleanup
on early returns.
No functional changes are intended in this series.
Testing:
- Compiled with W=1
- Build-tested on i86_64
Based on:
<linux-v7.0-rc2>
Feel free to share your valuable input in context of the cleanup API.
Thanks,
Sanjay Chitroda
Sanjay Chitroda (7):
staging: greybus: simplify cleanup using __free
iio: ssp_sensors: simplify cleanup using __free
iio: st_sensors: simplify cleanup using __free
media: mediatek: vcodec: simplify cleanup using __free
media: chips-media: coda: simplify cleanup using __free
media: allegro: simplify cleanup using __free
staging: rtl8723bs: simplify cleanup using __free
drivers/iio/common/ssp_sensors/ssp_spi.c | 9 +-
.../iio/common/st_sensors/st_sensors_core.c | 7 +-
.../media/platform/allegro-dvt/allegro-core.c | 95 +++++--------------
.../platform/chips-media/coda/coda-bit.c | 4 +-
.../platform/chips-media/coda/coda-jpeg.c | 39 ++++----
.../mediatek/vcodec/common/mtk_vcodec_dbgfs.c | 3 +-
drivers/staging/greybus/camera.c | 27 ++----
drivers/staging/greybus/loopback.c | 35 +++-----
drivers/staging/greybus/raw.c | 6 +-
.../staging/rtl8723bs/hal/rtl8723b_hal_init.c | 13 +--
drivers/staging/rtl8723bs/hal/sdio_ops.c | 37 ++------
11 files changed, 78 insertions(+), 197 deletions(-)
--
2.34.1