Commit 1eea4690 authored by Haibo Chen's avatar Haibo Chen Committed by Marc Kleine-Budde
Browse files

can: dev: keep the max bitrate error at 5%



Commit b360a13d ("can: dev: print bitrate error with two decimal
digits") changed calculation of the bit rate error from on-tenth of a
percent to on-hundredth of a percent, but forgot to adjust the scale of the
CAN_CALC_MAX_ERROR constant.

Keeping the existing logic unchanged: Only when the bitrate error exceeds
5% should an error be returned. Otherwise, simply output a warning log.

Fixes: b360a13d ("can: dev: print bitrate error with two decimal digits")
Signed-off-by: default avatarHaibo Chen <haibo.chen@nxp.com>
Link: https://patch.msgid.link/20260306-can-fix-v1-1-ac526cec6777@nxp.com


Cc: stable@kernel.org
[mkl: improve commit message]
Signed-off-by: default avatarMarc Kleine-Budde <mkl@pengutronix.de>
parent e3f5e0f2
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -8,7 +8,7 @@
#include <linux/units.h>
#include <linux/can/dev.h>

#define CAN_CALC_MAX_ERROR 50 /* in one-tenth of a percent */
#define CAN_CALC_MAX_ERROR 500 /* max error 5% */

/* CiA recommended sample points for Non Return to Zero encoding. */
static int can_calc_sample_point_nrz(const struct can_bittiming *bt)