Skip to content

drivers: Simplify cleanup paths using __free

Sanjay Chitroda linux-arm-kernel linux-iio linux-media linux-mediatek linux-staging lkml llvm oe-kbuild-all 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest7 patches 12 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/7staging: greybus: simplify cleanup using __freedrivers/staging/greybus/camera.c drivers/staging/greybus/loopback.c drivers/staging/greybus/raw.c+22 -463 replies
2/7iio: ssp_sensors: simplify cleanup using __freedrivers/iio/common/ssp_sensors/ssp_spi.c+2 -71 reply
3/7iio: st_sensors: simplify cleanup using __freedrivers/iio/common/st_sensors/st_sensors_core.c+2 -51 reply
4/7media: mediatek: vcodec: simplify cleanup using __freedrivers/media/platform/mediatek/vcodec/common/mtk_vcodec_dbgfs.c+1 -21 reply
5/7media: chips-media: coda: simplify cleanup using __freedrivers/media/platform/chips-media/coda/coda-bit.c drivers/media/platform/chips-media/coda/coda-jpeg.c+16 -270 replies
6/7media: allegro: simplify cleanup using __freedrivers/media/platform/allegro-dvt/allegro-core.c+24 -710 replies
7/7staging: rtl8723bs: simplify cleanup using __freedrivers/staging/rtl8723bs/hal/rtl8723b_hal_init.c drivers/staging/rtl8723bs/hal/sdio_ops.c+11 -392 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [PATCH 0/7] drivers: Simplify cleanup paths using __free

From: Sanjay Chitroda <[email protected]>

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(-)
Signature · 1 line
2.34.1