linux-stable/drivers/net/can/dev
Vincent Mailhol 6b6bd19992 can: netlink: remove redundant check in can_validate()
can_validate() does a first check:

|	if (is_can_fd) {
|		if (!data[IFLA_CAN_BITTIMING] || !data[IFLA_CAN_DATA_BITTIMING])
|			return -EOPNOTSUPP;
|	}

If that first if succeeds, we know that if is_can_fd is true then
data[IFLA_CAN_BITTIMING is set.

However, the next if switch does not leverage on above knowledge and
redoes the check:

| 	if (data[IFLA_CAN_DATA_BITTIMING]) {
|		if (!is_can_fd || !data[IFLA_CAN_BITTIMING])
|		                   ^~~~~~~~~~~~~~~~~~~~~~~~
| 			return -EOPNOTSUPP;
| 	}

This patch removes that redundant check.

Link: https://lore.kernel.org/r/20210603151550.140727-2-mailhol.vincent@wanadoo.fr
Signed-off-by: Vincent Mailhol <mailhol.vincent@wanadoo.fr>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
2021-07-25 11:36:25 +02:00
..
Makefile
bittiming.c can: bittiming: add CAN_KBPS, CAN_MBPS and CAN_MHZ macros 2021-03-30 11:14:45 +02:00
dev.c
length.c
netlink.c can: netlink: remove redundant check in can_validate() 2021-07-25 11:36:25 +02:00
rx-offload.c can: rx-offload: can_rx_offload_threaded_irq_finish(): add new function to be called from threaded interrupt 2021-07-25 11:36:25 +02:00
skb.c can: skb: alloc_can{,fd}_skb(): set "cf" to NULL if skb allocation fails 2021-04-07 09:31:19 +02:00