mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/herbert/cryptodev-2.6.git
synced 2026-04-23 05:56:14 -04:00
can: dev: register_candev(): bail out if both fixed bit rates and bit timing constants are provided
The CAN driver framework supports either fixed bit rates or bit timing constants. Bail out during driver registration if both are given. Link: https://lore.kernel.org/all/20230202110854.2318594-7-mkl@pengutronix.de Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
This commit is contained in:
@@ -530,6 +530,11 @@ int register_candev(struct net_device *dev)
|
||||
if (!priv->data_bitrate_const != !priv->data_bitrate_const_cnt)
|
||||
return -EINVAL;
|
||||
|
||||
/* We only support either fixed bit rates or bit timing const. */
|
||||
if ((priv->bitrate_const || priv->data_bitrate_const) &&
|
||||
(priv->bittiming_const || priv->data_bittiming_const))
|
||||
return -EINVAL;
|
||||
|
||||
if (!can_bittiming_const_valid(priv->bittiming_const) ||
|
||||
!can_bittiming_const_valid(priv->data_bittiming_const))
|
||||
return -EINVAL;
|
||||
|
||||
Reference in New Issue
Block a user