[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <aSbBTPXdk2wXQm7R@stanley.mountain>
Date: Wed, 26 Nov 2025 11:58:52 +0300
From: Dan Carpenter <dan.carpenter@...aro.org>
To: Dharanitharan R <dharanitharan725@...il.com>
Cc: thierry.reding@...il.com, jonathanh@...dia.com, skomatineni@...dia.com,
luca.ceresoli@...tlin.com, mchehab@...nel.org,
gregkh@...uxfoundation.org, linux-media@...r.kernel.org,
linux-tegra@...r.kernel.org, linux-staging@...ts.linux.dev,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH v1] media: tegra: vi: replace devm_kzalloc with kzalloc
in probe
On Wed, Nov 26, 2025 at 06:52:42AM +0000, Dharanitharan R wrote:
> Replace devm_kzalloc() (line 1881) with kzalloc() in tegra_vi_probe()
> since memory must be freed manually in error paths. Freed via kfree() in
> rpm_disable, as recommended in the file comment (line 1204).
>
drivers/staging/media/tegra-video/vi.c
1197 static int tegra_vi_channel_alloc(struct tegra_vi *vi, unsigned int port_num,
1198 struct device_node *node, unsigned int lanes)
1199 {
1200 struct tegra_vi_channel *chan;
1201 unsigned int i;
1202
1203 /*
1204 * Do not use devm_kzalloc as memory is freed immediately
1205 * when device instance is unbound but application might still
1206 * be holding the device node open. Channel memory allocated
1207 * with kzalloc is freed during video device release callback.
1208 */
1209 chan = kzalloc(sizeof(*chan), GFP_KERNEL);
1210 if (!chan)
1211 return -ENOMEM;
1212
The comment is specific to "chan".
Your patch introduces a number of memory leaks and it's not
correct.
regards,
dan carpenter
Powered by blists - more mailing lists