Commit 8e0a0b32 authored by Marc Kleine-Budde's avatar Marc Kleine-Budde

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.deSigned-off-by: default avatarMarc Kleine-Budde <mkl@pengutronix.de>
parent 52375446
...@@ -67,22 +67,18 @@ int can_get_bittiming(const struct net_device *dev, struct can_bittiming *bt, ...@@ -67,22 +67,18 @@ int can_get_bittiming(const struct net_device *dev, struct can_bittiming *bt,
const u32 *bitrate_const, const u32 *bitrate_const,
const unsigned int bitrate_const_cnt) const unsigned int bitrate_const_cnt)
{ {
int err;
/* Depending on the given can_bittiming parameter structure the CAN /* Depending on the given can_bittiming parameter structure the CAN
* timing parameters are calculated based on the provided bitrate OR * timing parameters are calculated based on the provided bitrate OR
* alternatively the CAN timing parameters (tq, prop_seg, etc.) are * alternatively the CAN timing parameters (tq, prop_seg, etc.) are
* provided directly which are then checked and fixed up. * provided directly which are then checked and fixed up.
*/ */
if (!bt->tq && bt->bitrate && btc) if (!bt->tq && bt->bitrate && btc)
err = can_calc_bittiming(dev, bt, btc); return can_calc_bittiming(dev, bt, btc);
else if (bt->tq && !bt->bitrate && btc) if (bt->tq && !bt->bitrate && btc)
err = can_fixup_bittiming(dev, bt, btc); return can_fixup_bittiming(dev, bt, btc);
else if (!bt->tq && bt->bitrate && bitrate_const) if (!bt->tq && bt->bitrate && bitrate_const)
err = can_validate_bitrate(dev, bt, bitrate_const, return can_validate_bitrate(dev, bt, bitrate_const,
bitrate_const_cnt); bitrate_const_cnt);
else
err = -EINVAL;
return err; return -EINVAL;
} }
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment