aboutsummaryrefslogtreecommitdiff
path: root/drivers/net/can
AgeCommit message (Collapse)AuthorFilesLines
2019-08-22can: Delete unnecessary checks before the macro call “dev_kfree_skb”Markus Elfring2-4/+2
The dev_kfree_skb() function performs also input parameter validation. Thus the test around the shown calls is not needed. This issue was detected by using the Coccinelle software. Signed-off-by: Markus Elfring <[email protected]> Acked-by: Sean Nyekjaer <[email protected]> Signed-off-by: David S. Miller <[email protected]>
2019-08-20can: mcp251x: remove custom DMA mapped bufferMarc Kleine-Budde1-48/+10
There is no need to duplicate what SPI core already does, i.e. mapping buffers for DMA capable transfers. This patch removes all related pices of code. Tested-by: Sean Nyekjaer <[email protected]> Signed-off-by: Marc Kleine-Budde <[email protected]>
2019-08-20can: mcp251x: Use DT-supplied interrupt flagsPhil Elwell1-1/+4
The MCP2515 datasheet clearly describes a level-triggered interrupt pin. Therefore the receiving interrupt controller must also be configured for level-triggered operation otherwise there is a danger of a missed interrupt condition blocking all subsequent interrupts. The ONESHOT flag ensures that the interrupt is masked until the threaded interrupt handler exits. Rather than change the flags globally (they must have worked for at least one user), keep the old behavior for for non DT devices. DT based devices specify the flags in their corresonding DT node. See: https://github.com/raspberrypi/linux/issues/2175 https://github.com/raspberrypi/linux/issues/2263 Signed-off-by: Phil Elwell <[email protected]> Tested-by: Sean Nyekjaer <[email protected]> Signed-off-by: Marc Kleine-Budde <[email protected]>
2019-08-20can: mcp251x: Use dev_name() during request_threaded_irq()Alexander Shiyan1-1/+2
Passing driver name as name during request_threaded_irq() results in all CAN IRQs have same name. This does not help much to easily identify which IRQ belongs to which CAN instance. Therefore pass dev_name() during request_threaded_irq() so that better identifiable name is listed for CAN devices in cat /proc/interrupts output. Output of cat /proc/interrupts Before this patch: 253: 2 gpio-mxc 13 Edge mcp251x 259: 2 gpio-mxc 19 Edge mcp251x After this patch: 253: 2 gpio-mxc 13 Edge spi1.1 259: 2 gpio-mxc 19 Edge spi1.2 Signed-off-by: Alexander Shiyan <[email protected]> Tested-by: Sean Nyekjaer <[email protected]> Signed-off-by: Marc Kleine-Budde <[email protected]>
2019-08-20can: mcp251x: mcp251x_hw_reset(): allow more time after a resetMarc Kleine-Budde1-5/+14
Some boards take longer than 5ms to power up after a reset, so allow some retries attempts before giving up. Fixes: ff06d611a31c ("can: mcp251x: Improve mcp251x_hw_reset()") Cc: linux-stable <[email protected]> Tested-by: Sean Nyekjaer <[email protected]> Signed-off-by: Marc Kleine-Budde <[email protected]>
2019-08-20can: mcp251x: use u8 instead of uint8_tMarc Kleine-Budde1-5/+4
This patch changes all the uint8_t in the arguments in several function to u8. Acked-by: Sean Nyekjaer <[email protected]> Signed-off-by: Marc Kleine-Budde <[email protected]>
2019-08-20can: mcp251x: fix print formating stringsMarc Kleine-Budde1-2/+1
This patch fixes the print format strings in the driver. Acked-by: Sean Nyekjaer <[email protected]> Signed-off-by: Marc Kleine-Budde <[email protected]>
2019-08-20can: mcp251x: avoid long linesMarc Kleine-Budde1-2/+4
This patch fixes long lines in the driver. Acked-by: Sean Nyekjaer <[email protected]> Signed-off-by: Marc Kleine-Budde <[email protected]>
2019-08-20can: mcp251x: remove unnecessary blank linesMarc Kleine-Budde1-2/+0
This patch removes unnecessary blank lines, so that checkpatch doesn't complain anymore. Acked-by: Sean Nyekjaer <[email protected]> Signed-off-by: Marc Kleine-Budde <[email protected]>
2019-08-20can: mcp251x: convert block comments to network style commentsMarc Kleine-Budde1-10/+5
This patch converts all block comments to network subsystem style block comments. Acked-by: Sean Nyekjaer <[email protected]> Signed-off-by: Marc Kleine-Budde <[email protected]>
2019-08-20can: m_can_platform: m_can_plat_probe(): add missing error handling if ↵Marc Kleine-Budde1-0/+3
mcan_class is NULL This patch adds the missing error handling in m_can_plat_probe() if mcan_class is NULL. Fixes: f524f829b75a ("can: m_can: Create a m_can platform framework") Signed-off-by: Marc Kleine-Budde <[email protected]>
2019-08-20can: m_can_platform: remove not needed casts to struct m_can_plat_priv *Marc Kleine-Budde1-8/+4
The struct m_can_classdev::device_data is a void pointer, so there's no need to cast it to struct m_can_plat_priv *, when assigning the struct m_can_plat_priv pointer. This patch removes the not needed casts from the m_can_platform driver. Signed-off-by: Marc Kleine-Budde <[email protected]>
2019-08-20can: tcan4x5x: fix data length in regmap write pathMarc Kleine-Budde1-2/+2
In regmap_spi_gather_write() the "addr" is prepared. The chip expects the number of 32 bit words to write in the lower 8 bits of addr. However the number of byte to write in shifted left by 3 (== divided by 8). The function tcan4x5x_regmap_write() is called with a data buffer, which holds the register information in the first 32 bits, followed by the actual data. tcan4x5x_regmap_write() calls regmap_spi_gather_write() with the val pointer pointing to the actual data (i.e. the original pointer is incremented by 4 bytes), but without decrementing the count. If the regmap framework only calls tcan4x5x_regmap_write() to read single 32 bit registers these two bugs cancel each other. This patch fixes the code. Fixes: 5443c226ba91 ("can: tcan4x5x: Add tcan4x5x driver to the kernel") Signed-off-by: Marc Kleine-Budde <[email protected]>
2019-08-20can: tcan4x5x: tcan4x5x_can_probe(): add missing error handling if ↵Marc Kleine-Budde1-0/+3
mcan_class is NULL This patch adds the missing error handling in tcan4x5x_can_probe() if mcan_class is NULL. Fixes: 5443c226ba91 ("can: tcan4x5x: Add tcan4x5x driver to the kernel") Signed-off-by: Marc Kleine-Budde <[email protected]>
2019-08-20can: tcan4x5x: remove not needed casts to struct tcan4x5x_priv *Marc Kleine-Budde1-13/+8
The struct m_can_classdev::device_data is a void pointer, so there's no need to cast it to struct tcan4x5x_priv *, when assigning the struct tcan4x5x_priv pointer. This patch removes the not needed casts from the tcan4x5x driver. Signed-off-by: Marc Kleine-Budde <[email protected]>
2019-08-20can: tcan4x5x: remove unused struct tcan4x5x_priv::tcan4x5x_lockMarc Kleine-Budde1-3/+0
The mutex struct tcan4x5x_priv::tcan4x5x_lock is unused in the driver, so this patch removes the variable from the driver. Signed-off-by: Marc Kleine-Budde <[email protected]>
2019-08-20can: hi311x: remove custom DMA mapped bufferMarc Kleine-Budde1-49/+10
There is no need to duplicate what SPI core already does, i.e. mapping buffers for DMA capable transfers. This patch removes all related pices of code. Signed-off-by: Marc Kleine-Budde <[email protected]>
2019-08-20can: peak_pci: Make structure peak_pciec_i2c_bit_ops constantNishka Dasgupta1-1/+1
Static structure peak_pciec_i2c_bit_ops, of type i2c_algo_bit_data, is not used except to be copied into another variable. Hence make it const to protect it from modification. Issue found with Coccinelle. Signed-off-by: Nishka Dasgupta <[email protected]> Signed-off-by: Marc Kleine-Budde <[email protected]>
2019-08-20can: rcar_can: Remove unused platform data supportGeert Uytterhoeven1-13/+9
All R-Car platforms use DT for describing CAN controllers. R-Car CAN platform data support was never used in any upstream kernel. Move the Clock Select Register settings enum into the driver, and remove platform data support and the corresponding header file. Signed-off-by: Geert Uytterhoeven <[email protected]> Reviewed-by: Wolfram Sang <[email protected]> Signed-off-by: Marc Kleine-Budde <[email protected]>
2019-08-13can: vcan: introduce pr_fmt and make use of itMarc Kleine-Budde1-2/+4
This patch introduces pr_fmt and makes use of it, also it converts a printk() to pr_info(). Signed-off-by: Marc Kleine-Budde <[email protected]>
2019-08-13can: vcan: remove unnecessary blank linesMarc Kleine-Budde1-2/+0
This patch removes unnecessary blank lines, so that checkpatch doesn't complain anymore. Signed-off-by: Marc Kleine-Budde <[email protected]>
2019-08-13can: vcan: convert block comments to network style commentsMarc Kleine-Budde1-8/+3
This patch converts all block comments to network subsystem style block comments. Signed-off-by: Marc Kleine-Budde <[email protected]>
2019-08-13can: xilinx_can: xcan_set_bittiming(): fix the data phase btr1 calculationSrinivas Neeli1-1/+1
While calculating bitrate for the data phase, the driver is using phase segment 1 of the arbitration phase instead of the data phase. Fixes: c223da6 ("can: xilinx_can: Add support for CANFD FD frames") Signed-off-by: Appana Durga Kedareswara rao <[email protected]> Signed-off-by: Srinivas Neeli <[email protected]> Acked-by: Shubhrajyoti Datta <[email protected]> Signed-off-by: Michal Simek <[email protected]> Signed-off-by: Marc Kleine-Budde <[email protected]>
2019-08-13can: xilinx_can: xcan_rx_fifo_get_next_frame(): fix FSR register FL and RI ↵Appana Durga Kedareswara rao1-3/+10
mask values for canfd 2.0 For CANFD 2.0 IP configuration existing driver is using incorrect mask values for FSR register FL and RI fields. Fixes: c223da6 ("can: xilinx_can: Add support for CANFD FD frames") Signed-off-by: Appana Durga Kedareswara rao <[email protected]> Acked-by: Shubhrajyoti Datta <[email protected]> Signed-off-by: Michal Simek <[email protected]> Signed-off-by: Marc Kleine-Budde <[email protected]>
2019-08-13can: xilinx_can: fix the data update logic for CANFD FD framesAppana Durga Kedareswara rao1-21/+8
commit c223da689324 ("can: xilinx_can: Add support for CANFD FD frames") is writing data to a wrong offset for FD frames. This patch fixes this issue. Fixes: c223da6 ("can: xilinx_can: Add support for CANFD FD frames") Reviewed-by: Radhey Shyam Pandey <[email protected]> Reviewed-by: Shubhrajyoti Datta <[email protected]> Signed-off-by: Appana Durga Kedareswara rao <[email protected]> Signed-off-by: Michal Simek <[email protected]> Signed-off-by: Marc Kleine-Budde <[email protected]>
2019-08-13can: xilinx_can: xcanfd_rx(): fix FSR register handling in the RX pathAppana Durga Kedareswara rao1-76/+63
After commit c223da689324 ("can: xilinx_can: Add support for CANFD FD frames") the driver is updating the FSR IRI index multiple times (i.e in xcanfd_rx() and xcan_rx_fifo_get_next_frame()), It should be updated once per RX packet. This patch fixes this issue, also this patch removes the unnecessary fsr register checks in xcanfd_rx() API. Fixes: c223da6 ("can: xilinx_can: Add support for CANFD FD frames") Reviewed-by: Radhey Shyam Pandey <[email protected]> Reviewed-by: Shubhrajyoti Datta <[email protected]> Signed-off-by: Appana Durga Kedareswara rao <[email protected]> Signed-off-by: Michal Simek <[email protected]> Signed-off-by: Marc Kleine-Budde <[email protected]>
2019-08-13can: xilinx_can: xcan_probe(): skip error message on deferred probeVenkatesh Yadav Abbarapu1-1/+2
When can clock is provided from the clock wizard, clock wizard driver may not be available when can driver probes resulting to the error message "Device clock not found error". As this error message is not very userful to the end user, skip printing it in the case of deferred probe. Fixes: b1201e44 ("can: xilinx CAN controller support") Signed-off-by: Appana Durga Kedareswara rao <[email protected]> Signed-off-by: Venkatesh Yadav Abbarapu <[email protected]> Signed-off-by: Michal Simek <[email protected]> Signed-off-by: Marc Kleine-Budde <[email protected]>
2019-08-13can: xilinx_can: xcan_chip_start(): fix failure with invalid busAnssi Hannula1-12/+1
Currently the xilinx_can xcan_chip_start() function, called from .ndo_open() and via CAN_MODE_START (bus-off restart), waits for the SR register to show the wanted operating state, with a 1 sec timeout. However, that register bit will only be set once the HW has observed 11 consecutive recessive bits (BusIdle) on the bus. If the bus will not see the 11 bits (e.g. it is stuck dominant), the function will timeout and return an error. If this was done as part of a scheduled restart from bus-off, the interface will stay in bus-off state forever even if the bus recovers later. According to M_CAN and FLEXCAN documentation they also wait for 11 consecutive recessive bits, but their drivers do not seem to wait for that. To make the behavior consistent, modify xilinx_can to also not wait for the synchronization to complete. The only way for users to know for sure that the bus has been joined successfully is to see successfully received or transmitted frames. That does not seem optimal, but it is consistent with other drivers and we should have a properly working restart-ms with xilinx_can. Tested on ZynqMP with Xilinx CAN-FD 1.0. Fixes: b1201e44f50b ("can: xilinx CAN controller support") Signed-off-by: Anssi Hannula <[email protected]> Tested-by: Appana Durga Kedareswara Rao <[email protected]> Signed-off-by: Marc Kleine-Budde <[email protected]>
2019-08-13can: ti_hecc: ti_hecc_mailbox_read(): remove set but not used variable ↵YueHaibing1-2/+1
'mbx_mask' Fixes gcc '-Wunused-but-set-variable' warning: drivers/net/can/ti_hecc.c: In function 'ti_hecc_mailbox_read': drivers/net/can/ti_hecc.c:533:12: warning: variable 'mbx_mask' set but not used [-Wunused-but-set-variable] It is never used so can be removed. Reported-by: Hulk Robot <[email protected]> Signed-off-by: YueHaibing <[email protected]> Reviewed-by: Jeroen Hofstee <[email protected]> Signed-off-by: Marc Kleine-Budde <[email protected]>
2019-08-13can: ti_hecc: ti_hecc_mailbox_read(): add blank lines to improve readabilityMarc Kleine-Budde1-0/+2
This patch adds two blank lines in ti_hecc_mailbox_read() to improve the readability of the function. Signed-off-by: Marc Kleine-Budde <[email protected]>
2019-08-13can: ti_hecc: ti_hecc_start(): avoid multiple assignmentsMarc Kleine-Budde1-1/+2
This patch changes the multiple assignments of HECC_TX_MASK in ti_hecc_start() into two single ones. Signed-off-by: Marc Kleine-Budde <[email protected]>
2019-08-13can: ti_hecc: fix print formating stringsMarc Kleine-Budde1-3/+4
This patch fixes the print format strings in the driver. Signed-off-by: Marc Kleine-Budde <[email protected]>
2019-08-13can: ti_hecc: avoid long linesMarc Kleine-Budde1-3/+5
This patch fixes long lines in the driver. Signed-off-by: Marc Kleine-Budde <[email protected]>
2019-08-13can: ti_hecc: fix indentionMarc Kleine-Budde1-20/+21
This patch fixes the indention in the driver. Signed-off-by: Marc Kleine-Budde <[email protected]>
2019-08-13can: ti_hecc: convert block comments to network style commentsMarc Kleine-Budde1-14/+7
This patch converts all block comments to network subsystem style block comments. Signed-off-by: Marc Kleine-Budde <[email protected]>
2019-08-13can: sja1000: f81601: remove unused including <linux/version.h>YueHaibing1-1/+0
Remove including <linux/version.h> that don't need it. Signed-off-by: YueHaibing <[email protected]> Signed-off-by: Marc Kleine-Budde <[email protected]>
2019-08-13can: kvaser_pciefd: Remove unused including <linux/version.h>YueHaibing1-1/+0
Remove including <linux/version.h> that don't need it. Reported-by: Hulk Robot <[email protected]> Signed-off-by: YueHaibing <[email protected]> Signed-off-by: Marc Kleine-Budde <[email protected]>
2019-08-13can: kvaser_pciefd: kvaser_pciefd_pwm_stop(): remove unnecessary code when ↵Christer Beskow1-7/+3
setting pwm duty cycle to zero To set the duty cycle to zero (i.e. pwm_stop), the trigger value shall be equal to the top value. This is achieved by reading the value of the top bit field from the pwm register and then writing back this value to the trigger and top bit fields. Addresses-Coverity: ("Logically dead code") Reported-by: Colin Ian King <[email protected]> Signed-off-by: Christer Beskow <[email protected]> Signed-off-by: Marc Kleine-Budde <[email protected]>
2019-08-06Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/netDavid S. Miller8-45/+70
Just minor overlapping changes in the conflicts here. Signed-off-by: David S. Miller <[email protected]>
2019-08-06Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/netLinus Torvalds8-46/+69
Pull networking fixes from David Miller: "Yeah I should have sent a pull request last week, so there is a lot more here than usual: 1) Fix memory leak in ebtables compat code, from Wenwen Wang. 2) Several kTLS bug fixes from Jakub Kicinski (circular close on disconnect etc.) 3) Force slave speed check on link state recovery in bonding 802.3ad mode, from Thomas Falcon. 4) Clear RX descriptor bits before assigning buffers to them in stmmac, from Jose Abreu. 5) Several missing of_node_put() calls, mostly wrt. for_each_*() OF loops, from Nishka Dasgupta. 6) Double kfree_skb() in peak_usb can driver, from Stephane Grosjean. 7) Need to hold sock across skb->destructor invocation, from Cong Wang. 8) IP header length needs to be validated in ipip tunnel xmit, from Haishuang Yan. 9) Use after free in ip6 tunnel driver, also from Haishuang Yan. 10) Do not use MSI interrupts on r8169 chips before RTL8168d, from Heiner Kallweit. 11) Upon bridge device init failure, we need to delete the local fdb. From Nikolay Aleksandrov. 12) Handle erros from of_get_mac_address() properly in stmmac, from Martin Blumenstingl. 13) Handle concurrent rename vs. dump in netfilter ipset, from Jozsef Kadlecsik. 14) Setting NETIF_F_LLTX on mac80211 causes complete breakage with some devices, so revert. From Johannes Berg. 15) Fix deadlock in rxrpc, from David Howells. 16) Fix Kconfig deps of enetc driver, we must have PHYLIB. From Yue Haibing. 17) Fix mvpp2 crash on module removal, from Matteo Croce. 18) Fix race in genphy_update_link, from Heiner Kallweit. 19) bpf_xdp_adjust_head() stopped working with generic XDP when we fixes generic XDP to support stacked devices properly, fix from Jesper Dangaard Brouer. 20) Unbalanced RCU locking in rt6_update_exception_stamp_rt(), from David Ahern. 21) Several memory leaks in new sja1105 driver, from Vladimir Oltean" * git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net: (214 commits) net: dsa: sja1105: Fix memory leak on meta state machine error path net: dsa: sja1105: Fix memory leak on meta state machine normal path net: dsa: sja1105: Really fix panic on unregistering PTP clock net: dsa: sja1105: Use the LOCKEDS bit for SJA1105 E/T as well net: dsa: sja1105: Fix broken learning with vlan_filtering disabled net: dsa: qca8k: Add of_node_put() in qca8k_setup_mdio_bus() net: sched: sample: allow accessing psample_group with rtnl net: sched: police: allow accessing police->params with rtnl net: hisilicon: Fix dma_map_single failed on arm64 net: hisilicon: fix hip04-xmit never return TX_BUSY net: hisilicon: make hip04_tx_reclaim non-reentrant tc-testing: updated vlan action tests with batch create/delete net sched: update vlan action for batched events operations net: stmmac: tc: Do not return a fragment entry net: stmmac: Fix issues when number of Queues >= 4 net: stmmac: xgmac: Fix XGMAC selftests be2net: disable bh with spin_lock in be_process_mcc net: cxgb3_main: Fix a resource leak in a error path in 'init_one()' net: ethernet: sun4i-emac: Support phy-handle property for finding PHYs net: bridge: move default pvid init/deinit to NETDEV_REGISTER/UNREGISTER ...
2019-08-02can: peak_usb: pcan_usb_pro: Fix info-leaks to USB devicesTomas Bortoli1-1/+1
Uninitialized Kernel memory can leak to USB devices. Fix by using kzalloc() instead of kmalloc() on the affected buffers. Signed-off-by: Tomas Bortoli <[email protected]> Reported-by: [email protected] Fixes: f14e22435a27 ("net: can: peak_usb: Do not do dma on the stack") Cc: linux-stable <[email protected]> Signed-off-by: Marc Kleine-Budde <[email protected]>
2019-08-02can: peak_usb: pcan_usb_fd: Fix info-leaks to USB devicesTomas Bortoli1-1/+1
Uninitialized Kernel memory can leak to USB devices. Fix by using kzalloc() instead of kmalloc() on the affected buffers. Signed-off-by: Tomas Bortoli <[email protected]> Reported-by: [email protected] Fixes: 0a25e1f4f185 ("can: peak_usb: add support for PEAK new CANFD USB adapters") Cc: linux-stable <[email protected]> Signed-off-by: Marc Kleine-Budde <[email protected]>
2019-08-02can: peak_usb: force the string buffer NULL-terminatedWang Xiayang1-1/+1
strncpy() does not ensure NULL-termination when the input string size equals to the destination buffer size IFNAMSIZ. The output string is passed to dev_info() which relies on the NULL-termination. Use strlcpy() instead. This issue is identified by a Coccinelle script. Signed-off-by: Wang Xiayang <[email protected]> Signed-off-by: Marc Kleine-Budde <[email protected]>
2019-08-02can: sja1000: force the string buffer NULL-terminatedWang Xiayang1-1/+1
strncpy() does not ensure NULL-termination when the input string size equals to the destination buffer size IFNAMSIZ. The output string 'name' is passed to dev_info which relies on NULL-termination. Use strlcpy() instead. This issue is identified by a Coccinelle script. Signed-off-by: Wang Xiayang <[email protected]> Signed-off-by: Marc Kleine-Budde <[email protected]>
2019-07-30net: Remove dev_err() usage after platform_get_irq()Stephen Boyd4-5/+0
We don't need dev_err() messages when platform_get_irq() fails now that platform_get_irq() prints an error message itself when something goes wrong. Let's remove these prints with a simple semantic patch. // <smpl> @@ expression ret; struct platform_device *E; @@ ret = ( platform_get_irq(E, ...) | platform_get_irq_byname(E, ...) ); if ( \( ret < 0 \| ret <= 0 \) ) { ( -if (ret != -EPROBE_DEFER) -{ ... -dev_err(...); -... } | ... -dev_err(...); ) ... } // </smpl> While we're here, remove braces on if statements that only have one statement (manually). Cc: "David S. Miller" <[email protected]> Cc: Kalle Valo <[email protected]> Cc: Saeed Mahameed <[email protected]> Cc: Jeff Kirsher <[email protected]> Cc: Felix Fietkau <[email protected]> Cc: Lorenzo Bianconi <[email protected]> Cc: [email protected] Cc: Greg Kroah-Hartman <[email protected]> Signed-off-by: Stephen Boyd <[email protected]> Signed-off-by: David S. Miller <[email protected]>
2019-07-25can: mark expected switch fall-throughsGustavo A. R. Silva4-5/+8
In preparation to enabling -Wimplicit-fallthrough, mark switch cases where we are expecting to fall through. This patch fixes the following warnings: drivers/net/can/peak_canfd/peak_pciefd_main.c:668:3: warning: this statement may fall through [-Wimplicit-fallthrough=] drivers/net/can/spi/mcp251x.c:875:7: warning: this statement may fall through [-Wimplicit-fallthrough=] drivers/net/can/usb/peak_usb/pcan_usb.c:422:6: warning: this statement may fall through [-Wimplicit-fallthrough=] drivers/net/can/at91_can.c:895:6: warning: this statement may fall through [-Wimplicit-fallthrough=] drivers/net/can/at91_can.c:953:15: warning: this statement may fall through [-Wimplicit-fallthrough=] drivers/net/can/usb/peak_usb/pcan_usb.c: In function ‘pcan_usb_decode_error’: drivers/net/can/usb/peak_usb/pcan_usb.c:422:6: warning: this statement may fall through [-Wimplicit-fallthrough=] if (n & PCAN_USB_ERROR_BUS_LIGHT) { ^ drivers/net/can/usb/peak_usb/pcan_usb.c:428:2: note: here case CAN_STATE_ERROR_WARNING: ^~~~ Warning level 3 was used: -Wimplicit-fallthrough=3 This patch is part of the ongoing efforts to enabling -Wimplicit-fallthrough. Notice that in some cases spelling mistakes were fixed. In other cases, the /* fall through */ comment is placed at the bottom of the case statement, which is what GCC is expecting to find. Signed-off-by: Gustavo A. R. Silva <[email protected]>
2019-07-24can: peak_usb: fix potential double kfree_skb()Stephane Grosjean1-4/+4
When closing the CAN device while tx skbs are inflight, echo skb could be released twice. By calling close_candev() before unlinking all pending tx urbs, then the internal echo_skb[] array is fully and correctly cleared before the USB write callback and, therefore, can_get_echo_skb() are called, for each aborted URB. Fixes: bb4785551f64 ("can: usb: PEAK-System Technik USB adapters driver core") Signed-off-by: Stephane Grosjean <[email protected]> Cc: linux-stable <[email protected]> Signed-off-by: Marc Kleine-Budde <[email protected]>
2019-07-24can: flexcan: fix stop mode acknowledgmentJoakim Zhang1-4/+27
To enter stop mode, the CPU should manually assert a global Stop Mode request and check the acknowledgment asserted by FlexCAN. The CPU must only consider the FlexCAN in stop mode when both request and acknowledgment conditions are satisfied. Fixes: de3578c198c6 ("can: flexcan: add self wakeup support") Reported-by: Marc Kleine-Budde <[email protected]> Signed-off-by: Joakim Zhang <[email protected]> Cc: linux-stable <[email protected]> # >= v5.0 Signed-off-by: Marc Kleine-Budde <[email protected]>
2019-07-24can: flexcan: fix an use-after-free in flexcan_setup_stop_mode()Wen Yang1-3/+5
The gpr_np variable is still being used in dev_dbg() after the of_node_put() call, which may result in use-after-free. Fixes: de3578c198c6 ("can: flexcan: add self wakeup support") Signed-off-by: Wen Yang <[email protected]> Cc: linux-stable <[email protected]> # >= v5.0 Signed-off-by: Marc Kleine-Budde <[email protected]>
2019-07-24can: mcp251x: add error check when wq alloc failedWeitao Hou1-27/+22
add error check when workqueue alloc failed, and remove redundant code to make it clear. Fixes: e0000163e30e ("can: Driver for the Microchip MCP251x SPI CAN controllers") Signed-off-by: Weitao Hou <[email protected]> Acked-by: Willem de Bruijn <[email protected]> Tested-by: Sean Nyekjaer <[email protected]> Signed-off-by: Marc Kleine-Budde <[email protected]>