Skip to content

Commit

Permalink
Merge tag 'linux-can-fixes-for-5.16-20220109' of git://git.kernel.org…
Browse files Browse the repository at this point in the history
…/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/20220109134040.1945428-1-mkl@pengutronix.de
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
  • Loading branch information
Jakub Kicinski committed Jan 9, 2022
2 parents 6dc9a23 + 89d58ae commit f4bb93a
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 10 deletions.
5 changes: 2 additions & 3 deletions drivers/net/can/rcar/rcar_canfd.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down Expand Up @@ -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;
}

Expand Down
2 changes: 1 addition & 1 deletion drivers/net/can/softing/softing_cs.c
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
11 changes: 6 additions & 5 deletions drivers/net/can/softing/softing_fw.c
Original file line number Diff line number Diff line change
Expand Up @@ -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]);
Expand Down
2 changes: 2 additions & 0 deletions drivers/net/can/usb/gs_usb.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
7 changes: 6 additions & 1 deletion drivers/net/can/xilinx_can.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit f4bb93a

Please sign in to comment.