hc
2024-09-20 a36159eec6ca17402b0e146b86efaf76568dc353
kernel/drivers/net/can/sun4i_can.c
....@@ -525,11 +525,6 @@
525525 rxerr = (errc >> 16) & 0xFF;
526526 txerr = errc & 0xFF;
527527
528
- if (skb) {
529
- cf->data[6] = txerr;
530
- cf->data[7] = rxerr;
531
- }
532
-
533528 if (isrc & SUN4I_INT_DATA_OR) {
534529 /* data overrun interrupt */
535530 netdev_dbg(dev, "data overrun interrupt\n");
....@@ -559,6 +554,10 @@
559554 state = CAN_STATE_ERROR_WARNING;
560555 else
561556 state = CAN_STATE_ERROR_ACTIVE;
557
+ }
558
+ if (skb && state != CAN_STATE_BUS_OFF) {
559
+ cf->data[6] = txerr;
560
+ cf->data[7] = rxerr;
562561 }
563562 if (isrc & SUN4I_INT_BUS_ERR) {
564563 /* bus error interrupt */
....@@ -604,7 +603,6 @@
604603 netdev_dbg(dev, "arbitration lost interrupt\n");
605604 alc = readl(priv->base + SUN4I_REG_STA_ADDR);
606605 priv->can.can_stats.arbitration_lost++;
607
- stats->tx_errors++;
608606 if (likely(skb)) {
609607 cf->can_id |= CAN_ERR_LOSTARB;
610608 cf->data[0] = (alc >> 8) & 0x1f;
....@@ -771,7 +769,6 @@
771769 static int sun4ican_probe(struct platform_device *pdev)
772770 {
773771 struct device_node *np = pdev->dev.of_node;
774
- struct resource *mem;
775772 struct clk *clk;
776773 void __iomem *addr;
777774 int err, irq;
....@@ -787,15 +784,13 @@
787784
788785 irq = platform_get_irq(pdev, 0);
789786 if (irq < 0) {
790
- dev_err(&pdev->dev, "could not get a valid irq\n");
791787 err = -ENODEV;
792788 goto exit;
793789 }
794790
795
- mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
796
- addr = devm_ioremap_resource(&pdev->dev, mem);
791
+ addr = devm_platform_ioremap_resource(pdev, 0);
797792 if (IS_ERR(addr)) {
798
- err = -EBUSY;
793
+ err = PTR_ERR(addr);
799794 goto exit;
800795 }
801796