pull-request: can 2022-01-09
Subsystems (7)
Marc Kleine-Budde
maintainercover pull-request: can 2022-01-09
Hello Jakub, hello David,
this is a pull request of 5 patches for net/master.
The first patch is by Johan Hovold and fixes a mem leak in the error path of the softing_cs driver.
The next patch is by me and fixes a set but not used variable warning in the softing driver.
Jiasheng Jiang's patch for the xilinx_can driver adds the missing error checking when getting the IRQ.
Lad Prabhakar contributes a patch for the rcar_canfd driver to fix a mem leak in the error path.
The last patch is by Brian Silverman and properly initializes the send USB messages to avoid spurious CAN error frames.
regards,
Marc
---
The following changes since commit 6dc9a23e29061e50c36523270de60039ccf536fa:
octeontx2-af: Fix interrupt name strings (2022-01-07 19:07:06 -0800)
are available in the Git repository at:
git://git.kernel.org/pub/scm/linux/kernel/git/mkl/linux-can.git tags/linux-can-fixes-for-5.16-20220109
for you to fetch changes up to 89d58aebe14a365c25ba6645414afdbf4e41cea4:
can: gs_usb: gs_can_start_xmit(): zero-initialize hf->{flags,reserved} (2022-01-09 13:32:28 +0100)
----------------------------------------------------------------
linux-can-fixes-for-5.16-20220109
----------------------------------------------------------------
Brian Silverman (1):
can: gs_usb: gs_can_start_xmit(): zero-initialize hf->{flags,reserved}Jiasheng Jiang (1):
can: xilinx_can: xcan_probe(): check for error irq
Johan Hovold (1):
can: softing_cs: softingcs_probe(): fix memleak on registration failure
Lad Prabhakar (1):
can: rcar_canfd: rcar_canfd_channel_probe(): make sure we free CAN network device
Marc Kleine-Budde (1):
can: softing: softing_startstop(): fix set but not used variable warning
drivers/net/can/rcar/rcar_canfd.c | 5 ++--- drivers/net/can/softing/softing_cs.c | 2 +- drivers/net/can/softing/softing_fw.c | 11 ++++++----- drivers/net/can/usb/gs_usb.c | 2 ++ drivers/net/can/xilinx_can.c | 7 ++++++- 5 files changed, 17 insertions(+), 10 deletions(-)
Marc Kleine-Budde
maintainerPATCH 1/5 can: softing_cs: softingcs_probe(): fix memleak on registration failure
From: Johan Hovold <[email protected]>
In case device registration fails during probe, the driver state and the embedded platform device structure needs to be freed using platform_device_put() to properly free all resources (e.g. the device name).
--- drivers/net/can/softing/softing_cs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/can/softing/softing_cs.c +1 -1
@@ -293,7 +293,7 @@ static int softingcs_probe(struct pcmcia_device *pcmcia)return 0 ; platform_failed: -kfree (dev); +platform_device_put (pdev); mem_failed: pcmcia_bad: pcmcia_failed:
base-commit: 6dc9a23e29061e50c36523270de60039ccf536fa
Signature · 1 line
2.34.1
Re: [PATCH net 1/5] can: softing_cs: softingcs_probe(): fix memleak on registration failure
This series was applied to netdev/net.git (master) by Marc Kleine-Budde <[email protected]>:
Hello:
This series was applied to netdev/net.git (master) by Marc Kleine-Budde <[email protected]>:
Quoted 8 lines · On Sun, 9 Jan 2022 14:40:36 +0100 you wrote:
From: Johan Hovold <[email protected]>
In case device registration fails during probe, the driver state and the embedded platform device structure needs to be freed using
platform_device_put()to properly free all resources (e.g. the device name).[...]
Here is the summary with links:
- [net,1/5] can: softing_cs: softingcs_probe(): fix memleak on registration failure
https://git.kernel.org/netdev/net/c/ced4913efb0a - [net,2/5] can: softing: softing_startstop(): fix set but not used variable warning https://git.kernel.org/netdev/net/c/370d988cc529 - [net,3/5] can: xilinx_can: xcan_probe(): check for error irq https://git.kernel.org/netdev/net/c/c6564c13dae2 - [net,4/5] can: rcar_canfd: rcar_canfd_channel_probe(): make sure we free CAN network device https://git.kernel.org/netdev/net/c/72b1e360572f - [net,5/5] can: gs_usb: gs_can_start_xmit(): zero-initialize hf->{flags,reserved} https://git.kernel.org/netdev/net/c/89d58aebe14a
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html
Marc Kleine-Budde
maintainerPATCH 2/5 can: softing: softing_startstop(): fix set but not used variable warning
In reply to Marc Kleine-BuddeIn the function softing_startstop() the variable error_reporting is assigned but not used. The code that uses this variable is commented out. Its stated that the functionality is not finally verified.
To fix the warning:
| drivers/net/can/softing/softing_fw.c:424:9: error: variable 'error_reporting' set but not used [-Werror,-Wunused-but-set-variable]
remove the comment, activate the code, but add a "0 &&" to the if expression and rely on the optimizer rather than the preprocessor to remove the code.
--- drivers/net/can/softing/softing_fw.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-)
drivers/net/can/softing/softing_fw.c +6 -5
@@ -565,18 +565,19 @@ int softing_startstop(struct net_device *dev, int up)if (ret <0 ) goto failed; } -/* enable_error_frame */ -/* + +/* enable_error_frame +* * Error reporting is switched off at the moment since * the receiving of them is not yet 100% verified * This should be enabled sooner or later -* -if (error_reporting) { +*/ +if (0 && error_reporting) { ret =softing_fct_cmd (card,51 ,"enable_error_frame" );if (ret <0 ) goto failed; } -*/ +/* initialize interface */ iowrite16 (1 , &card->dpram[DPRAM_FCT_PARAM +2 ]);iowrite16 (1 , &card->dpram[DPRAM_FCT_PARAM +4 ]);
Signature · 1 line
2.34.1
Marc Kleine-Budde
maintainerPATCH 3/5 can: xilinx_can: xcan_probe(): check for error irq
In reply to Marc Kleine-BuddeFrom: Jiasheng Jiang <[email protected]>
For the possible failure of the platform_get_irq(), the returned irq could be error number and will finally cause the failure of the request_irq().
Consider that platform_get_irq() can now in certain cases return -EPROBE_DEFER, and the consequences of letting request_irq() effectively convert that into -EINVAL, even at probe time rather than later on. So it might be better to check just now.
--- drivers/net/can/xilinx_can.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
drivers/net/can/xilinx_can.c +6 -1
@@ -1761,7 +1761,12 @@ static int xcan_probe(struct platform_device *pdev)spin_lock_init (&priv->tx_lock);/* Get IRQ for the device */ - ndev->irq =platform_get_irq (pdev,0 ); + ret =platform_get_irq (pdev,0 ); +if (ret <0 ) + goto err_free; + + ndev->irq = ret; + ndev->flags |=IFF_ECHO ;/* We support local echo */ platform_set_drvdata (pdev, ndev);
Signature · 1 line
2.34.1
Marc Kleine-Budde
maintainerPATCH 4/5 can: rcar_canfd: rcar_canfd_channel_probe(): make sure we free CAN network device
In reply to Marc Kleine-BuddeFrom: Lad Prabhakar <[email protected]>
Make sure we free CAN network device in the error path. There are several jumps to fail label after allocating the CAN network device successfully. This patch places the free_candev() under fail label so that in failure path a jump to fail label frees the CAN network device.
--- drivers/net/can/rcar/rcar_canfd.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
drivers/net/can/rcar/rcar_canfd.c +2 -3
@@ -1640,8 +1640,7 @@ static int rcar_canfd_channel_probe(struct rcar_canfd_global *gpriv, u32 ch, ndev =alloc_candev (sizeof (*priv),RCANFD_FIFO_DEPTH );if (!ndev) {dev_err (&pdev->dev,"alloc_candev() failed\n" ); - err = -ENOMEM ; - goto fail; +return -ENOMEM ; } priv =netdev_priv (ndev);
@@ -1735,8 +1734,8 @@ static int rcar_canfd_channel_probe(struct rcar_canfd_global *gpriv, u32 ch, fail_candev:netif_napi_del (&priv->napi); -free_candev (ndev); fail: +free_candev (ndev);return err; }
Signature · 1 line
2.34.1
Re: [PATCH net 4/5] can: rcar_canfd: rcar_canfd_channel_probe(): make sure we free CAN network device
Quoted 10 lines · Marc Kleine-Budde
From: Lad Prabhakar <[email protected]>
Make sure we free CAN network device in the error path. There are several jumps to fail label after allocating the CAN network device successfully. This patch places the
free_candev()under fail label so that in failure path a jump to fail label frees the CAN network device.Fixes 76e9353a80e9 ("can: rcar_canfd: Add support for RZ/G2L family")
Thank you!
Best regards,
Pavel
Signature · 2 lines
DENX Software Engineering GmbH, Managing Director: Wolfgang Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Marc Kleine-Budde
maintainerPATCH 5/5 can: gs_usb: gs_can_start_xmit(): zero-initialize hf->{flags,reserved}
In reply to Marc Kleine-BuddeFrom: Brian Silverman <[email protected]>
No information is deliberately sent in hf->flags in host -> device communications, but the open-source candleLight firmware echoes it back, which can result in the GS_CAN_FLAG_OVERFLOW flag being set and generating spurious ERRORFRAMEs.
While there also initialize the reserved member with 0.
--- drivers/net/can/usb/gs_usb.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/net/can/usb/gs_usb.c +2 -0
@@ -508,6 +508,8 @@ static netdev_tx_t gs_can_start_xmit(struct sk_buff *skb, hf->echo_id = idx; hf->channel = dev->channel; + hf->flags =0 ; + hf->reserved =0 ; cf = (struct can_frame *)skb->data;
Signature · 1 line
2.34.1