From: Raag Jadav <raag.jadav@intel.com>
To: eugen.hristev@linaro.org, mchehab@kernel.org,
nicolas.ferre@microchip.com, alexandre.belloni@bootlin.com,
claudiu.beznea@tuxon.dev, hugues.fruchet@foss.st.com,
alain.volmat@foss.st.com, mcoquelin.stm32@gmail.com,
alexandre.torgue@foss.st.com, andriy.shevchenko@linux.intel.com,
sakari.ailus@linux.intel.com
Cc: linux-media@vger.kernel.org, linux-kernel@vger.kernel.org,
Raag Jadav <raag.jadav@intel.com>
Subject: [PATCH v2 1/2] media: atmel-isi: use devm_kmemdup_array()
Date: Fri, 28 Feb 2025 13:06:48 +0530 [thread overview]
Message-ID: <20250228073649.152157-2-raag.jadav@intel.com> (raw)
In-Reply-To: <20250228073649.152157-1-raag.jadav@intel.com>
Convert to use devm_kmemdup_array() and while at it, make the size robust
against type changes.
Signed-off-by: Raag Jadav <raag.jadav@intel.com>
---
drivers/media/platform/atmel/atmel-isi.c | 8 ++------
1 file changed, 2 insertions(+), 6 deletions(-)
diff --git a/drivers/media/platform/atmel/atmel-isi.c b/drivers/media/platform/atmel/atmel-isi.c
index 0d1c39347529..7d8bec46af89 100644
--- a/drivers/media/platform/atmel/atmel-isi.c
+++ b/drivers/media/platform/atmel/atmel-isi.c
@@ -1072,16 +1072,12 @@ static int isi_formats_init(struct atmel_isi *isi)
return -ENXIO;
isi->num_user_formats = num_fmts;
- isi->user_formats = devm_kcalloc(isi->dev,
- num_fmts, sizeof(struct isi_format *),
- GFP_KERNEL);
+ isi->user_formats = devm_kmemdup_array(isi->dev, isi_fmts, num_fmts,
+ sizeof(isi_fmts[0]), GFP_KERNEL);
if (!isi->user_formats)
return -ENOMEM;
- memcpy(isi->user_formats, isi_fmts,
- num_fmts * sizeof(struct isi_format *));
isi->current_fmt = isi->user_formats[0];
-
return 0;
}
--
2.34.1
next prev parent reply other threads:[~2025-02-28 7:36 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-02-28 7:36 [PATCH v2 0/2] Convert media drivers to use devm_kmemdup_array() Raag Jadav
2025-02-28 7:36 ` Raag Jadav [this message]
2025-02-28 7:36 ` [PATCH v2 2/2] media: stm32-dcmi: " Raag Jadav
2025-03-10 6:45 ` [PATCH v2 0/2] Convert media drivers to " Raag Jadav
2025-03-10 10:53 ` Sakari Ailus
2025-03-11 6:31 ` Raag Jadav
2025-03-11 10:24 ` Sakari Ailus
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=20250228073649.152157-2-raag.jadav@intel.com \
--to=raag.jadav@intel.com \
--cc=alain.volmat@foss.st.com \
--cc=alexandre.belloni@bootlin.com \
--cc=alexandre.torgue@foss.st.com \
--cc=andriy.shevchenko@linux.intel.com \
--cc=claudiu.beznea@tuxon.dev \
--cc=eugen.hristev@linaro.org \
--cc=hugues.fruchet@foss.st.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=mchehab@kernel.org \
--cc=mcoquelin.stm32@gmail.com \
--cc=nicolas.ferre@microchip.com \
--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