mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-08-04 08:17:46 +00:00
can: bittiming: can_sjw_check(): report error via netlink and harmonize error value
If the user space has supplied an invalid SJW value (greater than the maximum SJW value), report -EINVAL instead of -ERANGE, this better matches the actual meaning of the error value. Additionally report an error message via netlink to the user space. Link: https://lore.kernel.org/all/20230202110854.2318594-13-mkl@pengutronix.de Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
This commit is contained in:
parent
de82d6185b
commit
0c017f0910
1 changed files with 5 additions and 2 deletions
|
@ -18,8 +18,11 @@ void can_sjw_set_default(struct can_bittiming *bt)
|
|||
int can_sjw_check(const struct net_device *dev, const struct can_bittiming *bt,
|
||||
const struct can_bittiming_const *btc, struct netlink_ext_ack *extack)
|
||||
{
|
||||
if (bt->sjw > btc->sjw_max)
|
||||
return -ERANGE;
|
||||
if (bt->sjw > btc->sjw_max) {
|
||||
NL_SET_ERR_MSG_FMT(extack, "sjw: %u greater than max sjw: %u",
|
||||
bt->sjw, btc->sjw_max);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue