drivers: can: stm32_can: Fix shifting zero width or out of bounds
When attaching the filters in a way that the filter width dos not change but the type, CAN_NO_FREE_FILTER was returned when the new filter is at the end. Also shifting is not necessary when the start is already out of bounds. Signed-off-by: Alexander Wachter <alexander.wachter@student.tugraz.at>
This commit is contained in:
parent
4fb64d11c8
commit
8484855428
1 changed files with 14 additions and 10 deletions
|
@ -702,6 +702,8 @@ static inline int can_stm32_set_filter(const struct zcan_filter *filter,
|
|||
scale_reg);
|
||||
|
||||
start_index = filter_index_new + filter_in_bank[bank_mode];
|
||||
|
||||
if (shift_width && start_index <= CAN_MAX_NUMBER_OF_FILTERS) {
|
||||
res = can_stm32_shift_arr(device_data->rx_response,
|
||||
start_index,
|
||||
shift_width);
|
||||
|
@ -715,6 +717,8 @@ static inline int can_stm32_set_filter(const struct zcan_filter *filter,
|
|||
can_stm32_shift_bits(&device_data->response_type,
|
||||
start_index,
|
||||
shift_width);
|
||||
}
|
||||
|
||||
can->FM1R = mode_reg;
|
||||
can->FS1R = scale_reg;
|
||||
} else {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue