Skip to content

Commit 8008762

Browse files
dlechjic23
authored andcommitted
iio: adc: ti-tsc2046: use = { } instead of memset()
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>
1 parent 5b4e9d5 commit 8008762

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

drivers/iio/adc/ti-tsc2046.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -276,7 +276,7 @@ static int tsc2046_adc_read_one(struct tsc2046_adc_priv *priv, int ch_idx,
276276
struct tsc2046_adc_ch_cfg *ch = &priv->ch_cfg[ch_idx];
277277
unsigned int val, val_normalized = 0;
278278
int ret, i, count_skip = 0, max_count;
279-
struct spi_transfer xfer;
279+
struct spi_transfer xfer = { };
280280
struct spi_message msg;
281281
u8 cmd;
282282

@@ -314,7 +314,6 @@ static int tsc2046_adc_read_one(struct tsc2046_adc_priv *priv, int ch_idx,
314314
/* automatically power down on last sample */
315315
tx_buf[i].cmd = tsc2046_adc_get_cmd(priv, ch_idx, false);
316316

317-
memset(&xfer, 0, sizeof(xfer));
318317
xfer.tx_buf = tx_buf;
319318
xfer.rx_buf = rx_buf;
320319
xfer.len = sizeof(*tx_buf) * max_count;

0 commit comments

Comments
 (0)