* [bug report] can: etas_es58x: add core support for ETAS ES58X CAN USB interfaces
@ 2022-02-01 14:03 Dan Carpenter
0 siblings, 0 replies; only message in thread
From: Dan Carpenter @ 2022-02-01 14:03 UTC (permalink / raw)
To: mailhol.vincent; +Cc: linux-can
Hello Vincent Mailhol,
The patch 8537257874e9: "can: etas_es58x: add core support for ETAS
ES58X CAN USB interfaces" from Apr 10, 2021, leads to the following
Smatch static checker warning:
drivers/net/can/usb/etas_es58x/es58x_core.c:1818 es58x_open()
warn: inconsistent refcounting 'es58x_dev->opened_channel_cnt.counter':
inc on: 1793
dec on: 1818
drivers/net/can/usb/etas_es58x/es58x_core.c
1785 static int es58x_open(struct net_device *netdev)
1786 {
1787 struct es58x_device *es58x_dev = es58x_priv(netdev)->es58x_dev;
1788 int ret;
1789
1790 if (atomic_inc_return(&es58x_dev->opened_channel_cnt) == 1) {
1791 ret = es58x_alloc_rx_urbs(es58x_dev);
1792 if (ret)
1793 return ret;
^^^^^^^^^^^
This error path should decrement &es58x_dev->opened_channel_cnt back to
zero?
1794
1795 ret = es58x_set_realtime_diff_ns(es58x_dev);
1796 if (ret)
1797 goto free_urbs;
1798 }
1799
1800 ret = open_candev(netdev);
1801 if (ret)
1802 goto free_urbs;
1803
1804 ret = es58x_dev->ops->enable_channel(es58x_priv(netdev));
1805 if (ret)
1806 goto free_urbs;
1807
1808 netif_start_queue(netdev);
1809
1810 return ret;
1811
1812 free_urbs:
1813 if (atomic_dec_and_test(&es58x_dev->opened_channel_cnt))
1814 es58x_free_urbs(es58x_dev);
1815 netdev_err(netdev, "%s: Could not open the network device: %pe\n",
1816 __func__, ERR_PTR(ret));
1817
--> 1818 return ret;
1819 }
regards,
dan carpenter
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2022-02-01 14:04 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-02-01 14:03 [bug report] can: etas_es58x: add core support for ETAS ES58X CAN USB interfaces Dan Carpenter
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).