diff options
author | Marc Kleine-Budde <mkl@pengutronix.de> | 2022-09-27 18:14:09 +0300 |
---|---|---|
committer | Marc Kleine-Budde <mkl@pengutronix.de> | 2023-02-06 15:57:25 +0300 |
commit | 8e0a0b32c4ff7a5c2654a5f8fc37a9f1b6f58816 (patch) | |
tree | 643a3f3af5cabc894b2b345199e4aac43196d1df /drivers/net/can/dev | |
parent | 52375446f2b52cfafa1804fc11570c992b894d94 (diff) | |
download | linux-8e0a0b32c4ff7a5c2654a5f8fc37a9f1b6f58816.tar.xz |
can: bittiming: can_get_bittiming(): use direct return and remove unneeded else
Clean up the code flow a bit, don't assign err variable but directly
return. Remove the unneeded else, too.
Link: https://lore.kernel.org/all/20230202110854.2318594-5-mkl@pengutronix.de
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
Diffstat (limited to 'drivers/net/can/dev')
-rw-r--r-- | drivers/net/can/dev/bittiming.c | 18 |
1 files changed, 7 insertions, 11 deletions
diff --git a/drivers/net/can/dev/bittiming.c b/drivers/net/can/dev/bittiming.c index e4917c2f34d3..263e46a1f648 100644 --- a/drivers/net/can/dev/bittiming.c +++ b/drivers/net/can/dev/bittiming.c @@ -67,22 +67,18 @@ int can_get_bittiming(const struct net_device *dev, struct can_bittiming *bt, const u32 *bitrate_const, const unsigned int bitrate_const_cnt) { - int err; - /* Depending on the given can_bittiming parameter structure the CAN * timing parameters are calculated based on the provided bitrate OR * alternatively the CAN timing parameters (tq, prop_seg, etc.) are * provided directly which are then checked and fixed up. */ if (!bt->tq && bt->bitrate && btc) - err = can_calc_bittiming(dev, bt, btc); - else if (bt->tq && !bt->bitrate && btc) - err = can_fixup_bittiming(dev, bt, btc); - else if (!bt->tq && bt->bitrate && bitrate_const) - err = can_validate_bitrate(dev, bt, bitrate_const, - bitrate_const_cnt); - else - err = -EINVAL; + return can_calc_bittiming(dev, bt, btc); + if (bt->tq && !bt->bitrate && btc) + return can_fixup_bittiming(dev, bt, btc); + if (!bt->tq && bt->bitrate && bitrate_const) + return can_validate_bitrate(dev, bt, bitrate_const, + bitrate_const_cnt); - return err; + return -EINVAL; } |