Skip to content

Commit f5ee52e

Browse files
bjarki-andreasennashif
authored andcommitted
drivers: can: nrf: fix invalid pointer leading to undef behavior
The can_nrf device driver incorrectly passes its own device driver pointer to a call to clock_control_get_rate() to get the rate of the auxpll. The actual device driver which should be passed to clock_control_get_rate() is the auxpll. Without this fix, the call jumps to the can_nrf_api and returns garbage (unfortunately it does not hardfault, which is why this issue has not been discovered yet). Signed-off-by: Bjarki Arge Andreasen <[email protected]>
1 parent 5d390b4 commit f5ee52e

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/can/can_nrf.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ static int configure_hsfll(const struct device *dev, bool on)
147147
if (on) {
148148
int ret;
149149

150-
ret = clock_control_get_rate(dev, NULL, &spec.frequency);
150+
ret = clock_control_get_rate(config->auxpll, NULL, &spec.frequency);
151151
if (ret < 0) {
152152
return ret;
153153
}

0 commit comments

Comments
 (0)