Skip to content
Commit 3b59d684 authored by Tristan Honscheid's avatar Tristan Honscheid Committed by Fabio Baltieri
Browse files

sensor: ism330dhcx: Incorrect handle passed to ctx struct in SPI mode



The ISM330DHCX driver immediately segfaults when run in SPI mode. A bad
pointer is being passed into the `dev` param of `ism330dhcx_spi_read`.
Tracing this back, it appears that the handle field of the ctx struct
is being set to the device's data struct while `ism330dhcx_spi_read`
expects `ctx->handle` to be a pointer to a device struct.

Modify `ism330dhcx_spi_init()` to insert the correct pointer into the
context struct. Unfortunately this requires a cast to discard the
`const` qualifier, but this is how it is done in I2C mode (see
`ism330dhcx_i2c_init()`). The only other way would be to change the
declaration of `stmdev_ctx_t`, which is owned by the HAL module.

Signed-off-by: default avatarTristan Honscheid <honscheid@google.com>
parent 96342211
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment