]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
iio: adc: ti-tsc2046: use = { } instead of memset()
authorDavid Lechner <dlechner@baylibre.com>
Wed, 11 Jun 2025 22:39:03 +0000 (17:39 -0500)
committerJonathan Cameron <Jonathan.Cameron@huawei.com>
Thu, 26 Jun 2025 18:32:56 +0000 (19:32 +0100)
Use { } instead of memset() to zero-initialize stack memory to simplify
the code.

Signed-off-by: David Lechner <dlechner@baylibre.com>
Reviewed-by: Oleksij Rempel <o.rempel@pengutronix.de>
Reviewed-by: Nuno Sá <nuno.sa@analog.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://patch.msgid.link/20250611-iio-zero-init-stack-with-instead-of-memset-v1-11-ebb2d0a24302@baylibre.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
drivers/iio/adc/ti-tsc2046.c

index c2d2aada6772aae6fc8d01c3878d6e869d413bc7..74471f08662e0291b097fcb277b8ad9cb6df200c 100644 (file)
@@ -276,7 +276,7 @@ static int tsc2046_adc_read_one(struct tsc2046_adc_priv *priv, int ch_idx,
        struct tsc2046_adc_ch_cfg *ch = &priv->ch_cfg[ch_idx];
        unsigned int val, val_normalized = 0;
        int ret, i, count_skip = 0, max_count;
-       struct spi_transfer xfer;
+       struct spi_transfer xfer = { };
        struct spi_message msg;
        u8 cmd;
 
@@ -314,7 +314,6 @@ static int tsc2046_adc_read_one(struct tsc2046_adc_priv *priv, int ch_idx,
        /* automatically power down on last sample */
        tx_buf[i].cmd = tsc2046_adc_get_cmd(priv, ch_idx, false);
 
-       memset(&xfer, 0, sizeof(xfer));
        xfer.tx_buf = tx_buf;
        xfer.rx_buf = rx_buf;
        xfer.len = sizeof(*tx_buf) * max_count;