diff --git a/drivers/dht/dht_saul.c b/drivers/dht/dht_saul.c index 1b5a9644c9..3a05601e0c 100644 --- a/drivers/dht/dht_saul.c +++ b/drivers/dht/dht_saul.c @@ -47,7 +47,8 @@ static int check_and_read(const void *dev, phydat_t *res, int16_t *val, uint8_t } res->val[0] = *val; - memset(&res->val[1], 0, 2 * sizeof(int16_t)); + res->val[1] = 0; + res->val[2] = 0; res->unit = unit; res->scale = -1; return 1; diff --git a/drivers/hdc1000/hdc1000_saul.c b/drivers/hdc1000/hdc1000_saul.c index dca43277a9..58bde0aba2 100644 --- a/drivers/hdc1000/hdc1000_saul.c +++ b/drivers/hdc1000/hdc1000_saul.c @@ -28,7 +28,8 @@ static int read_temp(const void *dev, phydat_t *res) if (hdc1000_read_cached((const hdc1000_t *)dev, &(res->val[0]), NULL) != HDC1000_OK) { return -ECANCELED; } - memset(&(res->val[1]), 0, 2 * sizeof(int16_t)); + res->val[1] = 0; + res->val[2] = 0; res->unit = UNIT_TEMP_C; res->scale = -2; @@ -40,7 +41,8 @@ static int read_hum(const void *dev, phydat_t *res) if (hdc1000_read_cached((const hdc1000_t *)dev, NULL, &(res->val[0])) != HDC1000_OK) { return -ECANCELED; } - memset(&(res->val[1]), 0, 2 * sizeof(int16_t)); + res->val[1] = 0; + res->val[2] = 0; res->unit = UNIT_PERCENT; res->scale = -2; diff --git a/drivers/isl29020/isl29020_saul.c b/drivers/isl29020/isl29020_saul.c index 5f5239e36c..16cae08b1a 100644 --- a/drivers/isl29020/isl29020_saul.c +++ b/drivers/isl29020/isl29020_saul.c @@ -26,7 +26,8 @@ static int read(const void *dev, phydat_t *res) { res->val[0] = (int16_t)isl29020_read((const isl29020_t *)dev); - memset(&(res->val[1]), 0, 2 * sizeof(int16_t)); + res->val[1] = 0; + res->val[2] = 0; res->unit = UNIT_CD; res->scale = 0; return 1; diff --git a/drivers/pir/pir_saul.c b/drivers/pir/pir_saul.c index eea97f6e3a..0ef5547da2 100644 --- a/drivers/pir/pir_saul.c +++ b/drivers/pir/pir_saul.c @@ -29,7 +29,8 @@ static int read_occup(const void *dev, phydat_t *res) { /* Read failure */ return -ECANCELED; } - memset(&(res->val[1]), 0, 2 * sizeof(int16_t)); + res->val[1] = 0; + res->val[2] = 0; res->unit = UNIT_PERCENT; res->scale = -2; return 1; diff --git a/drivers/saul/adc_saul.c b/drivers/saul/adc_saul.c index c732b1a852..0180b9643f 100644 --- a/drivers/saul/adc_saul.c +++ b/drivers/saul/adc_saul.c @@ -30,7 +30,8 @@ static int read_adc(const void *dev, phydat_t *res) { const saul_adc_params_t *params = *((const saul_adc_params_t **)dev); res->val[0] = adc_sample(params->line, params->res); - memset(&(res->val[1]), 0, 2 * sizeof(res->val[1])); + res->val[1] = 0; + res->val[2] = 0; /* Raw ADC reading has no unit */ res->unit = UNIT_NONE; res->scale = 0; diff --git a/drivers/saul/gpio_saul.c b/drivers/saul/gpio_saul.c index 0b5431c811..c1b95600da 100644 --- a/drivers/saul/gpio_saul.c +++ b/drivers/saul/gpio_saul.c @@ -33,7 +33,8 @@ static int read(const void *dev, phydat_t *res) res->val[0] = (gpio_read(p->pin)) ? !inverted : inverted; - memset(&(res->val[1]), 0, 2 * sizeof(int16_t)); + res->val[1] = 0; + res->val[2] = 0; res->unit = UNIT_BOOL; res->scale = 0; return 1;