mirror of
https://github.com/torvalds/linux.git
synced 2024-11-14 08:02:07 +00: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:
parent
d58ac89d0d
commit
a3db542410
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user