device: avoid casting away const from config_info pointer
The driver-specific config_info structure referenced from the device structure is marked const. Some drivers fail to preserve that qualifier when casting the pointer to the driver-specific structure, violating MISRA 11.8. Changes produced by scripts/coccinelle/const_config_info.cocci. Some changes proposed by the script are not included because they reveal mutation of state through the const pointer, though the code works as long as the driver-specific object is defined without the const qualifier. Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
This commit is contained in:
parent
49e8c7080f
commit
4f16b419e8
18 changed files with 41 additions and 41 deletions
|
@ -320,7 +320,7 @@ static int pwm_led_esp32_pin_set_cycles(struct device *dev,
|
|||
int timer;
|
||||
int ret;
|
||||
const struct pwm_led_esp32_config * const config =
|
||||
(struct pwm_led_esp32_config *) dev->config_info;
|
||||
(const struct pwm_led_esp32_config *) dev->config_info;
|
||||
|
||||
ARG_UNUSED(period_cycles);
|
||||
|
||||
|
@ -373,7 +373,7 @@ static int pwm_led_esp32_get_cycles_per_sec(struct device *dev, u32_t pwm,
|
|||
int timer;
|
||||
int speed_mode;
|
||||
|
||||
config = (struct pwm_led_esp32_config *) dev->config_info;
|
||||
config = (const struct pwm_led_esp32_config *) dev->config_info;
|
||||
|
||||
channel = pwm_led_esp32_get_gpio_config(pwm, config->ch_cfg);
|
||||
if (channel < 0) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue