* [PATCH net 0/5] pull-request: can 2022-01-09
@ 2022-01-09 13:40 Marc Kleine-Budde
2022-01-09 13:40 ` [PATCH net 1/5] can: softing_cs: softingcs_probe(): fix memleak on registration failure Marc Kleine-Budde
` (4 more replies)
0 siblings, 5 replies; 8+ messages in thread
From: Marc Kleine-Budde @ 2022-01-09 13:40 UTC (permalink / raw)
To: netdev; +Cc: davem, kuba, linux-can, kernel
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(-)
^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH net 1/5] can: softing_cs: softingcs_probe(): fix memleak on registration failure
2022-01-09 13:40 [PATCH net 0/5] pull-request: can 2022-01-09 Marc Kleine-Budde
@ 2022-01-09 13:40 ` Marc Kleine-Budde
2022-01-09 22:10 ` patchwork-bot+netdevbpf
2022-01-09 13:40 ` [PATCH net 2/5] can: softing: softing_startstop(): fix set but not used variable warning Marc Kleine-Budde
` (3 subsequent siblings)
4 siblings, 1 reply; 8+ messages in thread
From: Marc Kleine-Budde @ 2022-01-09 13:40 UTC (permalink / raw)
To: netdev
Cc: davem, kuba, linux-can, kernel, Johan Hovold, stable,
Greg Kroah-Hartman, Marc Kleine-Budde
From: Johan Hovold <johan@kernel.org>
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).
Fixes: 0a0b7a5f7a04 ("can: add driver for Softing card")
Link: https://lore.kernel.org/all/20211222104843.6105-1-johan@kernel.org
Cc: stable@vger.kernel.org # 2.6.38
Signed-off-by: Johan Hovold <johan@kernel.org>
Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
---
drivers/net/can/softing/softing_cs.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/can/softing/softing_cs.c b/drivers/net/can/softing/softing_cs.c
index 2e93ee792373..e5c939b63fa6 100644
--- a/drivers/net/can/softing/softing_cs.c
+++ b/drivers/net/can/softing/softing_cs.c
@@ -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
--
2.34.1
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH net 2/5] can: softing: softing_startstop(): fix set but not used variable warning
2022-01-09 13:40 [PATCH net 0/5] pull-request: can 2022-01-09 Marc Kleine-Budde
2022-01-09 13:40 ` [PATCH net 1/5] can: softing_cs: softingcs_probe(): fix memleak on registration failure Marc Kleine-Budde
@ 2022-01-09 13:40 ` Marc Kleine-Budde
2022-01-09 13:40 ` [PATCH net 3/5] can: xilinx_can: xcan_probe(): check for error irq Marc Kleine-Budde
` (2 subsequent siblings)
4 siblings, 0 replies; 8+ messages in thread
From: Marc Kleine-Budde @ 2022-01-09 13:40 UTC (permalink / raw)
To: netdev; +Cc: davem, kuba, linux-can, kernel, Marc Kleine-Budde, Kurt Van Dijck
In 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.
Link: https://lore.kernel.org/all/20220109103126.1872833-1-mkl@pengutronix.de
Fixes: 03fd3cf5a179 ("can: add driver for Softing card")
Cc: Kurt Van Dijck <dev.kurt@vandijck-laurijssen.be>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
---
drivers/net/can/softing/softing_fw.c | 11 ++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)
diff --git a/drivers/net/can/softing/softing_fw.c b/drivers/net/can/softing/softing_fw.c
index 7e1536877993..32286f861a19 100644
--- a/drivers/net/can/softing/softing_fw.c
+++ b/drivers/net/can/softing/softing_fw.c
@@ -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]);
--
2.34.1
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH net 3/5] can: xilinx_can: xcan_probe(): check for error irq
2022-01-09 13:40 [PATCH net 0/5] pull-request: can 2022-01-09 Marc Kleine-Budde
2022-01-09 13:40 ` [PATCH net 1/5] can: softing_cs: softingcs_probe(): fix memleak on registration failure Marc Kleine-Budde
2022-01-09 13:40 ` [PATCH net 2/5] can: softing: softing_startstop(): fix set but not used variable warning Marc Kleine-Budde
@ 2022-01-09 13:40 ` Marc Kleine-Budde
2022-01-09 13:40 ` [PATCH net 4/5] can: rcar_canfd: rcar_canfd_channel_probe(): make sure we free CAN network device Marc Kleine-Budde
2022-01-09 13:40 ` [PATCH net 5/5] can: gs_usb: gs_can_start_xmit(): zero-initialize hf->{flags,reserved} Marc Kleine-Budde
4 siblings, 0 replies; 8+ messages in thread
From: Marc Kleine-Budde @ 2022-01-09 13:40 UTC (permalink / raw)
To: netdev; +Cc: davem, kuba, linux-can, kernel, Jiasheng Jiang, Marc Kleine-Budde
From: Jiasheng Jiang <jiasheng@iscas.ac.cn>
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.
Fixes: b1201e44f50b ("can: xilinx CAN controller support")
Link: https://lore.kernel.org/all/20211224021324.1447494-1-jiasheng@iscas.ac.cn
Signed-off-by: Jiasheng Jiang <jiasheng@iscas.ac.cn>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
---
drivers/net/can/xilinx_can.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/drivers/net/can/xilinx_can.c b/drivers/net/can/xilinx_can.c
index e2b15d29d15e..af4a2adc8598 100644
--- a/drivers/net/can/xilinx_can.c
+++ b/drivers/net/can/xilinx_can.c
@@ -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);
--
2.34.1
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH net 4/5] can: rcar_canfd: rcar_canfd_channel_probe(): make sure we free CAN network device
2022-01-09 13:40 [PATCH net 0/5] pull-request: can 2022-01-09 Marc Kleine-Budde
` (2 preceding siblings ...)
2022-01-09 13:40 ` [PATCH net 3/5] can: xilinx_can: xcan_probe(): check for error irq Marc Kleine-Budde
@ 2022-01-09 13:40 ` Marc Kleine-Budde
2022-01-12 8:56 ` Pavel Machek
2022-01-09 13:40 ` [PATCH net 5/5] can: gs_usb: gs_can_start_xmit(): zero-initialize hf->{flags,reserved} Marc Kleine-Budde
4 siblings, 1 reply; 8+ messages in thread
From: Marc Kleine-Budde @ 2022-01-09 13:40 UTC (permalink / raw)
To: netdev
Cc: davem, kuba, linux-can, kernel, Lad Prabhakar, Pavel Machek,
Kieran Bingham, Marc Kleine-Budde
From: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
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")
Link: https://lore.kernel.org/all/20220106114801.20563-1-prabhakar.mahadev-lad.rj@bp.renesas.com
Reported-by: Pavel Machek <pavel@denx.de>
Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
Reviewed-by: Kieran Bingham <kieran.bingham+renesas@ideasonboard.com>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
---
drivers/net/can/rcar/rcar_canfd.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/drivers/net/can/rcar/rcar_canfd.c b/drivers/net/can/rcar/rcar_canfd.c
index ff9d0f5ae0dd..388521e70837 100644
--- a/drivers/net/can/rcar/rcar_canfd.c
+++ b/drivers/net/can/rcar/rcar_canfd.c
@@ -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;
}
--
2.34.1
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH net 5/5] can: gs_usb: gs_can_start_xmit(): zero-initialize hf->{flags,reserved}
2022-01-09 13:40 [PATCH net 0/5] pull-request: can 2022-01-09 Marc Kleine-Budde
` (3 preceding siblings ...)
2022-01-09 13:40 ` [PATCH net 4/5] can: rcar_canfd: rcar_canfd_channel_probe(): make sure we free CAN network device Marc Kleine-Budde
@ 2022-01-09 13:40 ` Marc Kleine-Budde
4 siblings, 0 replies; 8+ messages in thread
From: Marc Kleine-Budde @ 2022-01-09 13:40 UTC (permalink / raw)
To: netdev
Cc: davem, kuba, linux-can, kernel, Brian Silverman, stable,
Marc Kleine-Budde
From: Brian Silverman <brian.silverman@bluerivertech.com>
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.
Fixes: d08e973a77d1 ("can: gs_usb: Added support for the GS_USB CAN devices")
Link: https://lore.kernel.org/all/20220106002952.25883-1-brian.silverman@bluerivertech.com
Link: https://github.com/candle-usb/candleLight_fw/issues/87
Cc: stable@vger.kernel.org
Signed-off-by: Brian Silverman <brian.silverman@bluerivertech.com>
[mkl: initialize the reserved member, too]
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
---
drivers/net/can/usb/gs_usb.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/net/can/usb/gs_usb.c b/drivers/net/can/usb/gs_usb.c
index d7ce2c5956f4..4d43aca2ff56 100644
--- a/drivers/net/can/usb/gs_usb.c
+++ b/drivers/net/can/usb/gs_usb.c
@@ -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;
--
2.34.1
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH net 1/5] can: softing_cs: softingcs_probe(): fix memleak on registration failure
2022-01-09 13:40 ` [PATCH net 1/5] can: softing_cs: softingcs_probe(): fix memleak on registration failure Marc Kleine-Budde
@ 2022-01-09 22:10 ` patchwork-bot+netdevbpf
0 siblings, 0 replies; 8+ messages in thread
From: patchwork-bot+netdevbpf @ 2022-01-09 22:10 UTC (permalink / raw)
To: Marc Kleine-Budde
Cc: netdev, davem, kuba, linux-can, kernel, johan, stable, gregkh
Hello:
This series was applied to netdev/net.git (master)
by Marc Kleine-Budde <mkl@pengutronix.de>:
On Sun, 9 Jan 2022 14:40:36 +0100 you wrote:
> From: Johan Hovold <johan@kernel.org>
>
> 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!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH net 4/5] can: rcar_canfd: rcar_canfd_channel_probe(): make sure we free CAN network device
2022-01-09 13:40 ` [PATCH net 4/5] can: rcar_canfd: rcar_canfd_channel_probe(): make sure we free CAN network device Marc Kleine-Budde
@ 2022-01-12 8:56 ` Pavel Machek
0 siblings, 0 replies; 8+ messages in thread
From: Pavel Machek @ 2022-01-12 8:56 UTC (permalink / raw)
To: Marc Kleine-Budde
Cc: netdev, davem, kuba, linux-can, kernel, Lad Prabhakar,
Pavel Machek, Kieran Bingham
[-- Attachment #1: Type: text/plain, Size: 830 bytes --]
On Sun 2022-01-09 14:40:39, Marc Kleine-Budde wrote:
> From: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
>
> 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")
> Link: https://lore.kernel.org/all/20220106114801.20563-1-prabhakar.mahadev-lad.rj@bp.renesas.com
Reviewed-by: Pavel Machek <pavel@denx.de>
Thank you!
Best regards,
Pavel
--
DENX Software Engineering GmbH, Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 181 bytes --]
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2022-01-12 8:57 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-09 13:40 [PATCH net 0/5] pull-request: can 2022-01-09 Marc Kleine-Budde
2022-01-09 13:40 ` [PATCH net 1/5] can: softing_cs: softingcs_probe(): fix memleak on registration failure Marc Kleine-Budde
2022-01-09 22:10 ` patchwork-bot+netdevbpf
2022-01-09 13:40 ` [PATCH net 2/5] can: softing: softing_startstop(): fix set but not used variable warning Marc Kleine-Budde
2022-01-09 13:40 ` [PATCH net 3/5] can: xilinx_can: xcan_probe(): check for error irq Marc Kleine-Budde
2022-01-09 13:40 ` [PATCH net 4/5] can: rcar_canfd: rcar_canfd_channel_probe(): make sure we free CAN network device Marc Kleine-Budde
2022-01-12 8:56 ` Pavel Machek
2022-01-09 13:40 ` [PATCH net 5/5] can: gs_usb: gs_can_start_xmit(): zero-initialize hf->{flags,reserved} Marc Kleine-Budde
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.