Re: [PATCH] can: m_can: add support for handling arbitration error

From: kbuild test robot
Date: Mon Oct 14 2019 - 12:20:57 EST


Hi Pankaj,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on net/master]
[cannot apply to v5.4-rc3 next-20191014]
[if your patch is applied to the wrong git tree, please drop us a note to help
improve the system. BTW, we also suggest to use '--base' option to specify the
base tree in git format-patch, please see https://stackoverflow.com/a/37406982]

url: https://github.com/0day-ci/linux/commits/Pankaj-Sharma/can-m_can-add-support-for-handling-arbitration-error/20191014-193532
config: x86_64-fedora-25 (attached as .config)
compiler: gcc-7 (Debian 7.4.0-13) 7.4.0
reproduce:
# save the attached .config to linux build tree
make ARCH=x86_64

If you fix the issue, kindly add following tag
Reported-by: kbuild test robot <lkp@xxxxxxxxx>

All errors (new ones prefixed by >>):

drivers/net/can/m_can/m_can.c: In function 'm_can_handle_protocol_error':
>> drivers/net/can/m_can/m_can.c:800:10: error: dereferencing pointer to incomplete type 'struct m_can_priv'
if (priv->version >= 31 && (irqstatus & IR_PEA)) {
^~
drivers/net/can/m_can/m_can.c: In function 'm_can_handle_bus_errors':
>> drivers/net/can/m_can/m_can.c:828:7: error: 'priv' undeclared (first use in this function); did you mean 'pid'?
if ((priv->can.ctrlmode & CAN_CTRLMODE_BERR_REPORTING) &&
^~~~
pid
drivers/net/can/m_can/m_can.c:828:7: note: each undeclared identifier is reported only once for each function it appears in

vim +800 drivers/net/can/m_can/m_can.c

787
788 static int m_can_handle_protocol_error(struct net_device *dev, u32 irqstatus)
789 {
790 struct net_device_stats *stats = &dev->stats;
791 struct m_can_priv *priv = netdev_priv(dev);
792 struct can_frame *cf;
793 struct sk_buff *skb;
794
795 /* propagate the error condition to the CAN stack */
796 skb = alloc_can_err_skb(dev, &cf);
797 if (unlikely(!skb))
798 return 0;
799
> 800 if (priv->version >= 31 && (irqstatus & IR_PEA)) {
801 netdev_dbg(dev, "Protocol error in Arbitration fail\n");
802 stats->tx_errors++;
803 priv->can.can_stats.arbitration_lost++;
804 cf->can_id |= CAN_ERR_LOSTARB;
805 cf->data[0] |= CAN_ERR_LOSTARB_UNSPEC;
806 }
807
808 netif_receive_skb(skb);
809
810 return 1;
811 }
812
813 static int m_can_handle_bus_errors(struct net_device *dev, u32 irqstatus,
814 u32 psr)
815 {
816 struct m_can_classdev *cdev = netdev_priv(dev);
817 int work_done = 0;
818
819 if (irqstatus & IR_RF0L)
820 work_done += m_can_handle_lost_msg(dev);
821
822 /* handle lec errors on the bus */
823 if ((cdev->can.ctrlmode & CAN_CTRLMODE_BERR_REPORTING) &&
824 is_lec_err(psr))
825 work_done += m_can_handle_lec_err(dev, psr & LEC_UNUSED);
826
827 /* handle protocol errors in arbitration phase */
> 828 if ((priv->can.ctrlmode & CAN_CTRLMODE_BERR_REPORTING) &&
829 is_protocol_err(irqstatus))
830 work_done += m_can_handle_protocol_error(dev, irqstatus);
831
832 /* other unproccessed error interrupts */
833 m_can_handle_other_err(dev, irqstatus);
834
835 return work_done;
836 }
837

---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation

Attachment: .config.gz
Description: application/gzip