Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 130a5171 authored by Marc Kleine-Budde's avatar Marc Kleine-Budde
Browse files

can: c_can: check return value to users of c_can_set_bittiming()



This patch adds return value checking to all direct and indirect users of
c_can_set_bittiming().

Signed-off-by: default avatarMarc Kleine-Budde <mkl@pengutronix.de>
parent f29b4238
Loading
Loading
Loading
Loading
+22 −12
Original line number Original line Diff line number Diff line
@@ -631,7 +631,7 @@ static void c_can_configure_msg_objects(struct net_device *dev)
 * - set operating mode
 * - set operating mode
 * - configure message objects
 * - configure message objects
 */
 */
static void c_can_chip_config(struct net_device *dev)
static int c_can_chip_config(struct net_device *dev)
{
{
	struct c_can_priv *priv = netdev_priv(dev);
	struct c_can_priv *priv = netdev_priv(dev);


@@ -668,15 +668,18 @@ static void c_can_chip_config(struct net_device *dev)
	priv->write_reg(priv, C_CAN_STS_REG, LEC_UNUSED);
	priv->write_reg(priv, C_CAN_STS_REG, LEC_UNUSED);


	/* set bittiming params */
	/* set bittiming params */
	c_can_set_bittiming(dev);
	return c_can_set_bittiming(dev);
}
}


static void c_can_start(struct net_device *dev)
static int c_can_start(struct net_device *dev)
{
{
	struct c_can_priv *priv = netdev_priv(dev);
	struct c_can_priv *priv = netdev_priv(dev);
	int err;


	/* basic c_can configuration */
	/* basic c_can configuration */
	c_can_chip_config(dev);
	err = c_can_chip_config(dev);
	if (err)
		return err;


	priv->can.state = CAN_STATE_ERROR_ACTIVE;
	priv->can.state = CAN_STATE_ERROR_ACTIVE;


@@ -685,6 +688,8 @@ static void c_can_start(struct net_device *dev)


	/* enable status change, error and module interrupts */
	/* enable status change, error and module interrupts */
	c_can_enable_all_interrupts(priv, ENABLE_ALL_INTERRUPTS);
	c_can_enable_all_interrupts(priv, ENABLE_ALL_INTERRUPTS);

	return 0;
}
}


static void c_can_stop(struct net_device *dev)
static void c_can_stop(struct net_device *dev)
@@ -700,9 +705,13 @@ static void c_can_stop(struct net_device *dev)


static int c_can_set_mode(struct net_device *dev, enum can_mode mode)
static int c_can_set_mode(struct net_device *dev, enum can_mode mode)
{
{
	int err;

	switch (mode) {
	switch (mode) {
	case CAN_MODE_START:
	case CAN_MODE_START:
		c_can_start(dev);
		err = c_can_start(dev);
		if (err)
			return err;
		netif_wake_queue(dev);
		netif_wake_queue(dev);
		break;
		break;
	default:
	default:
@@ -1133,17 +1142,20 @@ static int c_can_open(struct net_device *dev)
		goto exit_irq_fail;
		goto exit_irq_fail;
	}
	}


	napi_enable(&priv->napi);
	/* start the c_can controller */
	err = c_can_start(dev);
	if (err)
		goto exit_start_fail;


	can_led_event(dev, CAN_LED_EVENT_OPEN);
	can_led_event(dev, CAN_LED_EVENT_OPEN);


	/* start the c_can controller */
	napi_enable(&priv->napi);
	c_can_start(dev);

	netif_start_queue(dev);
	netif_start_queue(dev);


	return 0;
	return 0;


exit_start_fail:
	free_irq(dev->irq, dev);
exit_irq_fail:
exit_irq_fail:
	close_candev(dev);
	close_candev(dev);
exit_open_fail:
exit_open_fail:
@@ -1260,9 +1272,7 @@ int c_can_power_up(struct net_device *dev)
	if (time_after(jiffies, time_out))
	if (time_after(jiffies, time_out))
		return -ETIMEDOUT;
		return -ETIMEDOUT;


	c_can_start(dev);
	return c_can_start(dev);

	return 0;
}
}
EXPORT_SYMBOL_GPL(c_can_power_up);
EXPORT_SYMBOL_GPL(c_can_power_up);
#endif
#endif