drivers: sensor: fxos8700: check gpio calls return code
Some GPIO related calls were not being checked for errors. This patch fixes coverity issue 236650. Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
This commit is contained in:
parent
6cfab29e19
commit
18732a5c74
1 changed files with 15 additions and 5 deletions
|
@ -408,6 +408,7 @@ int fxos8700_trigger_init(const struct device *dev)
|
||||||
const struct fxos8700_config *config = dev->config;
|
const struct fxos8700_config *config = dev->config;
|
||||||
struct fxos8700_data *data = dev->data;
|
struct fxos8700_data *data = dev->data;
|
||||||
uint8_t ctrl_reg5;
|
uint8_t ctrl_reg5;
|
||||||
|
int ret;
|
||||||
|
|
||||||
data->dev = dev;
|
data->dev = dev;
|
||||||
|
|
||||||
|
@ -469,16 +470,25 @@ int fxos8700_trigger_init(const struct device *dev)
|
||||||
|
|
||||||
data->gpio_pin = config->gpio_pin;
|
data->gpio_pin = config->gpio_pin;
|
||||||
|
|
||||||
gpio_pin_configure(data->gpio, config->gpio_pin,
|
ret = gpio_pin_configure(data->gpio, config->gpio_pin,
|
||||||
GPIO_INPUT | config->gpio_flags);
|
GPIO_INPUT | config->gpio_flags);
|
||||||
|
if (ret < 0) {
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
gpio_init_callback(&data->gpio_cb, fxos8700_gpio_callback,
|
gpio_init_callback(&data->gpio_cb, fxos8700_gpio_callback,
|
||||||
BIT(config->gpio_pin));
|
BIT(config->gpio_pin));
|
||||||
|
|
||||||
gpio_add_callback(data->gpio, &data->gpio_cb);
|
ret = gpio_add_callback(data->gpio, &data->gpio_cb);
|
||||||
|
if (ret < 0) {
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
gpio_pin_interrupt_configure(data->gpio, config->gpio_pin,
|
ret = gpio_pin_interrupt_configure(data->gpio, config->gpio_pin,
|
||||||
GPIO_INT_EDGE_TO_ACTIVE);
|
GPIO_INT_EDGE_TO_ACTIVE);
|
||||||
|
if (ret < 0) {
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue