Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

can: netlink: Fix TDCO calculation using the old data bittiming

The TDCO calculation was done using the currently applied data bittiming,
instead of the newly computed data bittiming, which means that the TDCO
had an invalid value unless setting the same data bittiming twice.

Fixes: d99755f71a80 ("can: netlink: add interface for CAN-FD Transmitter Delay Compensation (TDC)")
Signed-off-by: Maxime Jayat <maxime.jayat@mobile-devices.fr>
Reviewed-by: Vincent Mailhol <mailhol.vincent@wanadoo.fr>
Link: https://lore.kernel.org/all/40579c18-63c0-43a4-8d4c-f3a6c1c0b417@munic.io
Cc: stable@vger.kernel.org
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>

authored by

Maxime Jayat and committed by
Marc Kleine-Budde
2aa0a5e6 efe7cf82

+1 -1
+1 -1
drivers/net/can/dev/netlink.c
··· 346 346 /* Neither of TDC parameters nor TDC flags are 347 347 * provided: do calculation 348 348 */ 349 - can_calc_tdco(&priv->tdc, priv->tdc_const, &priv->data_bittiming, 349 + can_calc_tdco(&priv->tdc, priv->tdc_const, &dbt, 350 350 &priv->ctrlmode, priv->ctrlmode_supported); 351 351 } /* else: both CAN_CTRLMODE_TDC_{AUTO,MANUAL} are explicitly 352 352 * turned off. TDC is disabled: do nothing