From: Jonathan Cameron <jic23@kernel.org>
To: David Lechner <dlechner@baylibre.com>
Cc: "Michael Hennerich" <michael.hennerich@analog.com>,
"Lars-Peter Clausen" <lars@metafoo.de>,
"Nuno Sá" <nuno.sa@analog.com>,
"Andy Shevchenko" <andy@kernel.org>,
"Matthias Brugger" <matthias.bgg@gmail.com>,
"AngeloGioacchino Del Regno"
<angelogioacchino.delregno@collabora.com>,
"Heiko Stuebner" <heiko@sntech.de>,
"Maxime Coquelin" <mcoquelin.stm32@gmail.com>,
"Alexandre Torgue" <alexandre.torgue@foss.st.com>,
"Francesco Dolcini" <francesco@dolcini.it>,
"João Paulo Gonçalves" <jpaulo.silvagoncalves@gmail.com>,
"Leonard Göhrs" <l.goehrs@pengutronix.de>,
kernel@pengutronix.de, "Oleksij Rempel" <o.rempel@pengutronix.de>,
"Roan van Dijk" <roan@protonic.nl>,
"Tomasz Duszynski" <tomasz.duszynski@octakon.com>,
"Jacopo Mondi" <jacopo@jmondi.org>,
"Jean-Baptiste Maneyrol" <jean-baptiste.maneyrol@tdk.com>,
"Mudit Sharma" <muditsharma.info@gmail.com>,
"Javier Carrasco" <javier.carrasco.cruz@gmail.com>,
"Ondřej Jirman" <megi@xff.cz>,
"Andreas Klinger" <ak@it-klinger.de>,
"Petre Rodan" <petre.rodan@subdimension.ro>,
linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-arm-kernel@lists.infradead.org,
linux-mediatek@lists.infradead.org,
linux-rockchip@lists.infradead.org,
linux-stm32@st-md-mailman.stormreply.com
Subject: Re: [PATCH 25/28] iio: pressure: mprls0025pa: use = { } instead of memset()
Date: Sat, 14 Jun 2025 13:23:02 +0100 [thread overview]
Message-ID: <20250614132302.1e134315@jic23-huawei> (raw)
In-Reply-To: <20250611-iio-zero-init-stack-with-instead-of-memset-v1-25-ebb2d0a24302@baylibre.com>
On Wed, 11 Jun 2025 17:39:17 -0500
David Lechner <dlechner@baylibre.com> wrote:
> Use { } instead of memset() to zero-initialize stack memory to simplify
> the code.
>
> The initialize of the cmd value is trivial so it can be moved to the
> array initializer as well.
>
> Signed-off-by: David Lechner <dlechner@baylibre.com>
> ---
> drivers/iio/pressure/mprls0025pa_i2c.c | 5 +----
> 1 file changed, 1 insertion(+), 4 deletions(-)
>
> diff --git a/drivers/iio/pressure/mprls0025pa_i2c.c b/drivers/iio/pressure/mprls0025pa_i2c.c
> index 1a48f8d43d716b28b8fceb8e1a06d63a73a74a86..79811fd4a02b370b3fde8bd67a5115a3934f8614 100644
> --- a/drivers/iio/pressure/mprls0025pa_i2c.c
> +++ b/drivers/iio/pressure/mprls0025pa_i2c.c
> @@ -44,10 +44,7 @@ static int mpr_i2c_write(struct mpr_data *data, const u8 cmd, const u8 unused)
> {
> int ret;
> struct i2c_client *client = to_i2c_client(data->dev);
> - u8 wdata[MPR_PKT_SYNC_LEN];
> -
> - memset(wdata, 0, sizeof(wdata));
> - wdata[0] = cmd;
> + u8 wdata[MPR_PKT_SYNC_LEN] = { cmd };
Slight preference for trailing comma after cmd,
>
> ret = i2c_master_send(client, wdata, MPR_PKT_SYNC_LEN);
> if (ret < 0)
>
WARNING: multiple messages have this Message-ID (diff)
From: Jonathan Cameron <jic23@kernel.org>
To: David Lechner <dlechner@baylibre.com>
Cc: "Michael Hennerich" <michael.hennerich@analog.com>,
"Lars-Peter Clausen" <lars@metafoo.de>,
"Nuno Sá" <nuno.sa@analog.com>,
"Andy Shevchenko" <andy@kernel.org>,
"Matthias Brugger" <matthias.bgg@gmail.com>,
"AngeloGioacchino Del Regno"
<angelogioacchino.delregno@collabora.com>,
"Heiko Stuebner" <heiko@sntech.de>,
"Maxime Coquelin" <mcoquelin.stm32@gmail.com>,
"Alexandre Torgue" <alexandre.torgue@foss.st.com>,
"Francesco Dolcini" <francesco@dolcini.it>,
"João Paulo Gonçalves" <jpaulo.silvagoncalves@gmail.com>,
"Leonard Göhrs" <l.goehrs@pengutronix.de>,
kernel@pengutronix.de, "Oleksij Rempel" <o.rempel@pengutronix.de>,
"Roan van Dijk" <roan@protonic.nl>,
"Tomasz Duszynski" <tomasz.duszynski@octakon.com>,
"Jacopo Mondi" <jacopo@jmondi.org>,
"Jean-Baptiste Maneyrol" <jean-baptiste.maneyrol@tdk.com>,
"Mudit Sharma" <muditsharma.info@gmail.com>,
"Javier Carrasco" <javier.carrasco.cruz@gmail.com>,
"Ondřej Jirman" <megi@xff.cz>,
"Andreas Klinger" <ak@it-klinger.de>,
"Petre Rodan" <petre.rodan@subdimension.ro>,
linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-arm-kernel@lists.infradead.org,
linux-mediatek@lists.infradead.org,
linux-rockchip@lists.infradead.org,
linux-stm32@st-md-mailman.stormreply.com
Subject: Re: [PATCH 25/28] iio: pressure: mprls0025pa: use = { } instead of memset()
Date: Sat, 14 Jun 2025 13:23:02 +0100 [thread overview]
Message-ID: <20250614132302.1e134315@jic23-huawei> (raw)
In-Reply-To: <20250611-iio-zero-init-stack-with-instead-of-memset-v1-25-ebb2d0a24302@baylibre.com>
On Wed, 11 Jun 2025 17:39:17 -0500
David Lechner <dlechner@baylibre.com> wrote:
> Use { } instead of memset() to zero-initialize stack memory to simplify
> the code.
>
> The initialize of the cmd value is trivial so it can be moved to the
> array initializer as well.
>
> Signed-off-by: David Lechner <dlechner@baylibre.com>
> ---
> drivers/iio/pressure/mprls0025pa_i2c.c | 5 +----
> 1 file changed, 1 insertion(+), 4 deletions(-)
>
> diff --git a/drivers/iio/pressure/mprls0025pa_i2c.c b/drivers/iio/pressure/mprls0025pa_i2c.c
> index 1a48f8d43d716b28b8fceb8e1a06d63a73a74a86..79811fd4a02b370b3fde8bd67a5115a3934f8614 100644
> --- a/drivers/iio/pressure/mprls0025pa_i2c.c
> +++ b/drivers/iio/pressure/mprls0025pa_i2c.c
> @@ -44,10 +44,7 @@ static int mpr_i2c_write(struct mpr_data *data, const u8 cmd, const u8 unused)
> {
> int ret;
> struct i2c_client *client = to_i2c_client(data->dev);
> - u8 wdata[MPR_PKT_SYNC_LEN];
> -
> - memset(wdata, 0, sizeof(wdata));
> - wdata[0] = cmd;
> + u8 wdata[MPR_PKT_SYNC_LEN] = { cmd };
Slight preference for trailing comma after cmd,
>
> ret = i2c_master_send(client, wdata, MPR_PKT_SYNC_LEN);
> if (ret < 0)
>
_______________________________________________
Linux-rockchip mailing list
Linux-rockchip@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-rockchip
next prev parent reply other threads:[~2025-06-14 12:26 UTC|newest]
Thread overview: 92+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-06-11 22:38 [PATCH 00/28] iio: zero init stack with { } instead of memset() David Lechner
2025-06-11 22:38 ` David Lechner
2025-06-11 22:38 ` [PATCH 01/28] iio: accel: adxl372: use = " David Lechner
2025-06-11 22:38 ` David Lechner
2025-06-11 22:38 ` [PATCH 02/28] iio: accel: msa311: " David Lechner
2025-06-11 22:38 ` David Lechner
2025-06-11 22:38 ` [PATCH 03/28] iio: adc: dln2-adc: " David Lechner
2025-06-11 22:38 ` David Lechner
2025-06-11 22:38 ` [PATCH 04/28] iio: adc: mt6360-adc: " David Lechner
2025-06-11 22:38 ` David Lechner
2025-06-11 22:38 ` [PATCH 05/28] iio: adc: rockchip_saradc: " David Lechner
2025-06-11 22:38 ` David Lechner
2025-06-11 22:38 ` [PATCH 06/28] iio: adc: rtq6056: " David Lechner
2025-06-11 22:38 ` David Lechner
2025-06-11 22:38 ` [PATCH 07/28] iio: adc: stm32-adc: " David Lechner
2025-06-11 22:38 ` David Lechner
2025-06-11 22:39 ` [PATCH 08/28] iio: adc: ti-ads1015: " David Lechner
2025-06-11 22:39 ` David Lechner
2025-06-11 22:39 ` [PATCH 09/28] iio: adc: ti-ads1119: " David Lechner
2025-06-11 22:39 ` David Lechner
2025-06-12 8:16 ` Francesco Dolcini
2025-06-12 8:16 ` Francesco Dolcini
2025-06-11 22:39 ` [PATCH 10/28] iio: adc: ti-lmp92064: " David Lechner
2025-06-11 22:39 ` David Lechner
2025-06-12 5:41 ` Leonard Göhrs
2025-06-12 5:41 ` Leonard Göhrs
2025-06-11 22:39 ` [PATCH 11/28] iio: adc: ti-tsc2046: " David Lechner
2025-06-11 22:39 ` David Lechner
2025-06-12 4:30 ` Oleksij Rempel
2025-06-12 4:30 ` Oleksij Rempel
2025-06-11 22:39 ` [PATCH 12/28] iio: chemical: scd4x: " David Lechner
2025-06-11 22:39 ` David Lechner
2025-06-11 22:39 ` [PATCH 13/28] iio: chemical: scd30: " David Lechner
2025-06-11 22:39 ` David Lechner
2025-06-11 22:39 ` [PATCH 14/28] iio: chemical: sunrise_co2: " David Lechner
2025-06-11 22:39 ` David Lechner
2025-06-11 22:39 ` [PATCH 15/28] iio: dac: ad3552r: " David Lechner
2025-06-11 22:39 ` David Lechner
2025-06-11 22:39 ` [PATCH 16/28] iio: imu: inv_icm42600: " David Lechner
2025-06-11 22:39 ` David Lechner
2025-06-14 12:21 ` Jonathan Cameron
2025-06-14 12:21 ` Jonathan Cameron
2025-06-11 22:39 ` [PATCH 17/28] iio: imu: inv_mpu6050: " David Lechner
2025-06-11 22:39 ` David Lechner
2025-06-11 22:39 ` [PATCH 18/28] iio: light: bh1745: " David Lechner
2025-06-11 22:39 ` David Lechner
2025-06-11 22:39 ` [PATCH 19/28] iio: light: ltr501: " David Lechner
2025-06-11 22:39 ` David Lechner
2025-06-11 22:39 ` [PATCH 20/28] iio: light: opt4060: " David Lechner
2025-06-11 22:39 ` David Lechner
2025-06-11 22:39 ` [PATCH 21/28] iio: light: veml6030: " David Lechner
2025-06-11 22:39 ` David Lechner
2025-06-12 3:28 ` Javier Carrasco
2025-06-12 3:28 ` Javier Carrasco
2025-06-11 22:39 ` [PATCH 22/28] iio: magnetometer: af8133j: " David Lechner
2025-06-11 22:39 ` David Lechner
2025-06-11 22:39 ` [PATCH 23/28] iio: pressure: bmp280: " David Lechner
2025-06-11 22:39 ` David Lechner
2025-06-11 22:39 ` [PATCH 24/28] iio: pressure: mpl3115: " David Lechner
2025-06-11 22:39 ` David Lechner
2025-06-11 22:39 ` [PATCH 25/28] iio: pressure: mprls0025pa: " David Lechner
2025-06-11 22:39 ` David Lechner
2025-06-14 12:23 ` Jonathan Cameron [this message]
2025-06-14 12:23 ` Jonathan Cameron
2025-06-11 22:39 ` [PATCH 26/28] iio: pressure: zpa2326: " David Lechner
2025-06-11 22:39 ` David Lechner
2025-06-11 22:39 ` [PATCH 27/28] iio: proximity: irsd200: " David Lechner
2025-06-11 22:39 ` David Lechner
2025-06-11 22:39 ` [PATCH 28/28] iio: temperature: tmp006: " David Lechner
2025-06-11 22:39 ` David Lechner
2025-06-12 6:09 ` [PATCH 00/28] iio: zero init stack with " Nuno Sá
2025-06-12 6:09 ` Nuno Sá
2025-06-12 9:17 ` Pavel Machek
2025-06-12 9:17 ` Pavel Machek
2025-06-12 10:45 ` Jonathan Cameron
2025-06-12 10:45 ` Jonathan Cameron
2025-06-12 12:11 ` Nicolas Frattaroli
2025-06-12 12:11 ` Nicolas Frattaroli
2025-06-12 12:28 ` Andy Shevchenko
2025-06-12 12:28 ` Andy Shevchenko
2025-06-12 18:54 ` Pavel Machek
2025-06-12 18:54 ` Pavel Machek
2025-06-12 19:10 ` Andy Shevchenko
2025-06-12 19:10 ` Andy Shevchenko
2025-06-14 6:47 ` Pavel Machek
2025-06-14 6:47 ` Pavel Machek
2025-06-14 12:18 ` Jonathan Cameron
2025-06-14 12:18 ` Jonathan Cameron
2025-06-14 14:18 ` Jonathan Cameron
2025-06-14 14:18 ` Jonathan Cameron
2025-06-12 12:51 ` Andy Shevchenko
2025-06-12 12: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=20250614132302.1e134315@jic23-huawei \
--to=jic23@kernel.org \
--cc=ak@it-klinger.de \
--cc=alexandre.torgue@foss.st.com \
--cc=andy@kernel.org \
--cc=angelogioacchino.delregno@collabora.com \
--cc=dlechner@baylibre.com \
--cc=francesco@dolcini.it \
--cc=heiko@sntech.de \
--cc=jacopo@jmondi.org \
--cc=javier.carrasco.cruz@gmail.com \
--cc=jean-baptiste.maneyrol@tdk.com \
--cc=jpaulo.silvagoncalves@gmail.com \
--cc=kernel@pengutronix.de \
--cc=l.goehrs@pengutronix.de \
--cc=lars@metafoo.de \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-iio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mediatek@lists.infradead.org \
--cc=linux-rockchip@lists.infradead.org \
--cc=linux-stm32@st-md-mailman.stormreply.com \
--cc=matthias.bgg@gmail.com \
--cc=mcoquelin.stm32@gmail.com \
--cc=megi@xff.cz \
--cc=michael.hennerich@analog.com \
--cc=muditsharma.info@gmail.com \
--cc=nuno.sa@analog.com \
--cc=o.rempel@pengutronix.de \
--cc=petre.rodan@subdimension.ro \
--cc=roan@protonic.nl \
--cc=tomasz.duszynski@octakon.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.