[PATCH v2] media: imx-jpeg: convert kzalloc_obj() to devm_kzalloc()

Marc Kleine-Budde mkl at blackshift.org
Mon Mar 9 08:53:57 PDT 2026


On 08.03.2026 11:35:54, Sanjay Chitroda wrote:
> From: Sanjay Chitroda <sanjayembeddedse at gmail.com>
>
> The driver allcoates memory using kzalloc_obj() and frees it in the relase
> path. since the allocated memory is tied to the lifetime of the device,
> devm_kzalloc() can be used instead.

What happens if you issue multiple open()/close() cycles per device
lifetime? Will the memory pile up, until the mxc_jpeg_remove() function
is called?

> Using device-managed allocation simplifies the error handling paths and
> remove the need for manual cleanup.
>
> No functional change intended.

Marc

-- 
Pengutronix e.K.                 | Marc Kleine-Budde          |
Embedded Linux                   | https://www.pengutronix.de |
Vertretung Nürnberg              | Phone: +49-5121-206917-129 |
Amtsgericht Hildesheim, HRA 2686 | Fax:   +49-5121-206917-9   |
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 228 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20260309/1a08a6fe/attachment.sig>


More information about the linux-arm-kernel mailing list