Commit 3fd7bfd2 authored by Ziyang Xuan's avatar Ziyang Xuan Committed by Marc Kleine-Budde

can: bcm: check the result of can_send() in bcm_can_tx()

If can_send() fail, it should not update frames_abs counter
in bcm_can_tx(). Add the result check for can_send() in bcm_can_tx().
Suggested-by: default avatarMarc Kleine-Budde <mkl@pengutronix.de>
Suggested-by: default avatarOliver Hartkopp <socketcan@hartkopp.net>
Signed-off-by: default avatarZiyang Xuan <william.xuanziyang@huawei.com>
Link: https://lore.kernel.org/all/9851878e74d6d37aee2f1ee76d68361a46f89458.1663206163.git.william.xuanziyang@huawei.comAcked-by: default avatarOliver Hartkopp <socketcan@hartkopp.net>
Signed-off-by: default avatarMarc Kleine-Budde <mkl@pengutronix.de>
parent edd1a7e4
...@@ -274,6 +274,7 @@ static void bcm_can_tx(struct bcm_op *op) ...@@ -274,6 +274,7 @@ static void bcm_can_tx(struct bcm_op *op)
struct sk_buff *skb; struct sk_buff *skb;
struct net_device *dev; struct net_device *dev;
struct canfd_frame *cf = op->frames + op->cfsiz * op->currframe; struct canfd_frame *cf = op->frames + op->cfsiz * op->currframe;
int err;
/* no target device? => exit */ /* no target device? => exit */
if (!op->ifindex) if (!op->ifindex)
...@@ -298,11 +299,11 @@ static void bcm_can_tx(struct bcm_op *op) ...@@ -298,11 +299,11 @@ static void bcm_can_tx(struct bcm_op *op)
/* send with loopback */ /* send with loopback */
skb->dev = dev; skb->dev = dev;
can_skb_set_owner(skb, op->sk); can_skb_set_owner(skb, op->sk);
can_send(skb, 1); err = can_send(skb, 1);
if (!err)
op->frames_abs++;
/* update statistics */
op->currframe++; op->currframe++;
op->frames_abs++;
/* reached last frame? */ /* reached last frame? */
if (op->currframe >= op->nframes) if (op->currframe >= op->nframes)
......
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