Skip to content

Commit 09ef2e6

Browse files
alexanderwachternashif
authored andcommitted
drivers: can: common: Fix uninitializes sjw
Fix coverity CID 216784. SJW was not initialized in the tmp_res, but got copied to the result pointer, which overwrites the value. Signed-off-by: Alexander Wachter <[email protected]>
1 parent ecf918c commit 09ef2e6

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

drivers/can/can_common.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,9 @@ static int can_calc_timing_int(uint32_t core_clock, struct can_timing *res,
216216

217217
if (sp_err < sp_err_min) {
218218
sp_err_min = sp_err;
219-
*res = tmp_res;
219+
res->prop_seg = tmp_res.prop_seg;
220+
res->phase_seg1 = tmp_res.phase_seg1;
221+
res->phase_seg2 = tmp_res.phase_seg2;
220222
res->prescaler = (uint16_t)prescaler;
221223
if (sp_err == 0) {
222224
/* No better result than a perfect match*/

0 commit comments

Comments
 (0)