* [PATCH] staging: media: atomisp: use kvcalloc() in ia_css_refcount_init()
@ 2026-12-05 6:57 Shaunak Datar
2026-12-05 10:51 ` Andy Shevchenko
0 siblings, 1 reply; 2+ messages in thread
From: Shaunak Datar @ 2026-12-05 6:57 UTC (permalink / raw)
To: Hans de Goede, Mauro Carvalho Chehab
Cc: Sakari Ailus, Andy Shevchenko, Greg Kroah-Hartman, linux-media,
linux-staging, linux-kernel, Shaunak Datar
ia_css_refcount_init() was using kvmalloc() and memset(), update that to
use kvcalloc() which returns zeroed memory.
Signed-off-by: Shaunak Datar <shaunakkdatar@gmail.com>
---
.../atomisp/pci/base/refcount/src/refcount.c | 16 +++++-----------
1 file changed, 5 insertions(+), 11 deletions(-)
diff --git a/drivers/staging/media/atomisp/pci/base/refcount/src/refcount.c b/drivers/staging/media/atomisp/pci/base/refcount/src/refcount.c
index 168180f3873e..b4be21955245 100644
--- a/drivers/staging/media/atomisp/pci/base/refcount/src/refcount.c
+++ b/drivers/staging/media/atomisp/pci/base/refcount/src/refcount.c
@@ -59,8 +59,6 @@ static struct ia_css_refcount_entry *refcount_find_entry(ia_css_ptr ptr,
int ia_css_refcount_init(uint32_t size)
{
- int err = 0;
-
if (size == 0) {
ia_css_debug_dtrace(IA_CSS_DEBUG_TRACE,
"%s(): Size of 0 for Ref count init!\n", __func__);
@@ -71,16 +69,12 @@ int ia_css_refcount_init(uint32_t size)
"%s(): Ref count is already initialized\n", __func__);
return -EINVAL;
}
- myrefcount.items =
- kvmalloc(sizeof(struct ia_css_refcount_entry) * size, GFP_KERNEL);
+ myrefcount.items = kvcalloc(size, sizeof(struct ia_css_refcount_entry), GFP_KERNEL);
if (!myrefcount.items)
- err = -ENOMEM;
- if (!err) {
- memset(myrefcount.items, 0,
- sizeof(struct ia_css_refcount_entry) * size);
- myrefcount.size = size;
- }
- return err;
+ return -ENOMEM;
+
+ myrefcount.size = size;
+ return 0;
}
void ia_css_refcount_uninit(void)
--
2.53.0
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] staging: media: atomisp: use kvcalloc() in ia_css_refcount_init()
2026-12-05 6:57 [PATCH] staging: media: atomisp: use kvcalloc() in ia_css_refcount_init() Shaunak Datar
@ 2026-12-05 10:51 ` Andy Shevchenko
0 siblings, 0 replies; 2+ messages in thread
From: Andy Shevchenko @ 2026-12-05 10:51 UTC (permalink / raw)
To: Shaunak Datar, Kees Cook
Cc: Hans de Goede, Mauro Carvalho Chehab, Sakari Ailus,
Andy Shevchenko, Greg Kroah-Hartman, linux-media, linux-staging,
linux-kernel
On Sat, Dec 5, 2026 at 8:58 AM Shaunak Datar <shaunakkdatar@gmail.com> wrote:
>
> ia_css_refcount_init() was using kvmalloc() and memset(), update that to
> use kvcalloc() which returns zeroed memory.
Hmm... So far we don't have kvcalloc_objs() or alike.
Hence this patch is good as it is for now.
Reviewed-by: Andy Shevchenko <andy@kernel.org>
--
With Best Regards,
Andy Shevchenko
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-12-05 10:51 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-12-05 6:57 [PATCH] staging: media: atomisp: use kvcalloc() in ia_css_refcount_init() Shaunak Datar
2026-12-05 10:51 ` Andy Shevchenko
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®