mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Shaunak Datar <shaunakkdatar@gmail.com>
To: Hans de Goede <hansg@kernel.org>,
	Mauro Carvalho Chehab <mchehab@kernel.org>
Cc: Sakari Ailus <sakari.ailus@linux.intel.com>,
	Andy Shevchenko <andy@kernel.org>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	linux-media@vger.kernel.org, linux-staging@lists.linux.dev,
	linux-kernel@vger.kernel.org,
	Shaunak Datar <shaunakkdatar@gmail.com>
Subject: [PATCH] staging: media: atomisp: use kvcalloc() in ia_css_refcount_init()
Date: Sat,  5 Dec 2026 12:27:35 +0530	[thread overview]
Message-ID: <20261205065735.382138-1-shaunakkdatar@gmail.com> (raw)

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


             reply	other threads:[~2026-12-05  6:58 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-12-05  6:57 Shaunak Datar [this message]
2026-12-05 10:51 ` Andy Shevchenko

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261205065735.382138-1-shaunakkdatar@gmail.com \
    --to=shaunakkdatar@gmail.com \
    --cc=andy@kernel.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=hansg@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=linux-staging@lists.linux.dev \
    --cc=mchehab@kernel.org \
    --cc=sakari.ailus@linux.intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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®