mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-08-31 10:31:33 -04:00
iio: chemical: scd30: 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: 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-13-ebb2d0a24302@baylibre.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
This commit is contained in:
committed by
Jonathan Cameron
parent
27d782612a
commit
5226b48b57
@@ -587,7 +587,7 @@ static irqreturn_t scd30_trigger_handler(int irq, void *p)
|
||||
struct {
|
||||
int data[SCD30_MEAS_COUNT];
|
||||
aligned_s64 ts;
|
||||
} scan;
|
||||
} scan = { };
|
||||
int ret;
|
||||
|
||||
mutex_lock(&state->lock);
|
||||
@@ -595,7 +595,6 @@ static irqreturn_t scd30_trigger_handler(int irq, void *p)
|
||||
ret = scd30_read_poll(state);
|
||||
else
|
||||
ret = scd30_read_meas(state);
|
||||
memset(&scan, 0, sizeof(scan));
|
||||
memcpy(scan.data, state->meas, sizeof(state->meas));
|
||||
mutex_unlock(&state->lock);
|
||||
if (ret)
|
||||
|
||||
Reference in New Issue
Block a user