Skip to content

Commit f4bb93a

Browse files
committed
Merge tag 'linux-can-fixes-for-5.16-20220109' of git://git.kernel.org/pub/scm/linux/kernel/git/mkl/linux-can
Marc Kleine-Budde says: ==================== pull-request: can 2022-01-09 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. * tag 'linux-can-fixes-for-5.16-20220109' of git://git.kernel.org/pub/scm/linux/kernel/git/mkl/linux-can: can: gs_usb: gs_can_start_xmit(): zero-initialize hf->{flags,reserved} can: rcar_canfd: rcar_canfd_channel_probe(): make sure we free CAN network device can: xilinx_can: xcan_probe(): check for error irq can: softing: softing_startstop(): fix set but not used variable warning can: softing_cs: softingcs_probe(): fix memleak on registration failure ==================== Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
2 parents 6dc9a23 + 89d58ae commit f4bb93a

File tree

5 files changed

+17
-10
lines changed

5 files changed

+17
-10
lines changed

drivers/net/can/rcar/rcar_canfd.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1640,8 +1640,7 @@ static int rcar_canfd_channel_probe(struct rcar_canfd_global *gpriv, u32 ch,
16401640
ndev = alloc_candev(sizeof(*priv), RCANFD_FIFO_DEPTH);
16411641
if (!ndev) {
16421642
dev_err(&pdev->dev, "alloc_candev() failed\n");
1643-
err = -ENOMEM;
1644-
goto fail;
1643+
return -ENOMEM;
16451644
}
16461645
priv = netdev_priv(ndev);
16471646

@@ -1735,8 +1734,8 @@ static int rcar_canfd_channel_probe(struct rcar_canfd_global *gpriv, u32 ch,
17351734

17361735
fail_candev:
17371736
netif_napi_del(&priv->napi);
1738-
free_candev(ndev);
17391737
fail:
1738+
free_candev(ndev);
17401739
return err;
17411740
}
17421741

drivers/net/can/softing/softing_cs.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -293,7 +293,7 @@ static int softingcs_probe(struct pcmcia_device *pcmcia)
293293
return 0;
294294

295295
platform_failed:
296-
kfree(dev);
296+
platform_device_put(pdev);
297297
mem_failed:
298298
pcmcia_bad:
299299
pcmcia_failed:

drivers/net/can/softing/softing_fw.c

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -565,18 +565,19 @@ int softing_startstop(struct net_device *dev, int up)
565565
if (ret < 0)
566566
goto failed;
567567
}
568-
/* enable_error_frame */
569-
/*
568+
569+
/* enable_error_frame
570+
*
570571
* Error reporting is switched off at the moment since
571572
* the receiving of them is not yet 100% verified
572573
* This should be enabled sooner or later
573-
*
574-
if (error_reporting) {
574+
*/
575+
if (0 && error_reporting) {
575576
ret = softing_fct_cmd(card, 51, "enable_error_frame");
576577
if (ret < 0)
577578
goto failed;
578579
}
579-
*/
580+
580581
/* initialize interface */
581582
iowrite16(1, &card->dpram[DPRAM_FCT_PARAM + 2]);
582583
iowrite16(1, &card->dpram[DPRAM_FCT_PARAM + 4]);

drivers/net/can/usb/gs_usb.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -508,6 +508,8 @@ static netdev_tx_t gs_can_start_xmit(struct sk_buff *skb,
508508

509509
hf->echo_id = idx;
510510
hf->channel = dev->channel;
511+
hf->flags = 0;
512+
hf->reserved = 0;
511513

512514
cf = (struct can_frame *)skb->data;
513515

drivers/net/can/xilinx_can.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1761,7 +1761,12 @@ static int xcan_probe(struct platform_device *pdev)
17611761
spin_lock_init(&priv->tx_lock);
17621762

17631763
/* Get IRQ for the device */
1764-
ndev->irq = platform_get_irq(pdev, 0);
1764+
ret = platform_get_irq(pdev, 0);
1765+
if (ret < 0)
1766+
goto err_free;
1767+
1768+
ndev->irq = ret;
1769+
17651770
ndev->flags |= IFF_ECHO; /* We support local echo */
17661771

17671772
platform_set_drvdata(pdev, ndev);

0 commit comments

Comments
 (0)