From: <nobuhiro1.iwamatsu@toshiba.co.jp>
To: <prabhakar.mahadev-lad.rj@bp.renesas.com>,
<cip-dev@lists.cip-project.org>, <pavel@denx.de>
Cc: <biju.das.jz@bp.renesas.com>
Subject: RE: [PATCH 5.10.y-cip] can: rcar_canfd: rcar_canfd_channel_probe(): make sure we free CAN network device
Date: Wed, 26 Jan 2022 22:02:45 +0000 [thread overview]
Message-ID: <TYAPR01MB625274BC4EFFA92D99EF211792209@TYAPR01MB6252.jpnprd01.prod.outlook.com> (raw)
In-Reply-To: <20220126202213.31975-1-prabhakar.mahadev-lad.rj@bp.renesas.com>
Hi,
> -----Original Message-----
> From: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
> Sent: Thursday, January 27, 2022 5:22 AM
> To: cip-dev@lists.cip-project.org; iwamatsu nobuhiro(岩松 信洋 □SWC◯A
> CT) <nobuhiro1.iwamatsu@toshiba.co.jp>; Pavel Machek
> <pavel@denx.de>
> Cc: Biju Das <biju.das.jz@bp.renesas.com>
> Subject: [PATCH 5.10.y-cip] can: rcar_canfd: rcar_canfd_channel_probe():
> make sure we free CAN network device
>
> commit 72b1e360572f9fa7d08ee554f1da29abce23f288 upstream.
>
> 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.r
> j@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>
> Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
> ---
> drivers/net/can/rcar/rcar_canfd.c | 5 ++---
> 1 file changed, 2 insertions(+), 3 deletions(-)
LGTM.
If there is no other opinion, I can apply this.
Test: https://gitlab.com/cip-project/cip-kernel/linux-cip/-/pipelines/457123034
Best regards,
Nobuhiro
>
> diff --git a/drivers/net/can/rcar/rcar_canfd.c
> b/drivers/net/can/rcar/rcar_canfd.c
> index 52629c6c1970..6c8e7a51b04d 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.17.1
next prev parent reply other threads:[~2022-01-26 22:03 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-01-26 20:22 [PATCH 5.10.y-cip] can: rcar_canfd: rcar_canfd_channel_probe(): make sure we free CAN network device Lad Prabhakar
2022-01-26 22:02 ` nobuhiro1.iwamatsu [this message]
2022-01-26 22:05 ` Pavel Machek
2022-01-27 9:39 ` nobuhiro1.iwamatsu
2022-01-27 11:16 ` Prabhakar Mahadev Lad
2022-01-26 22:12 ` Pavel Machek
2022-01-26 22:34 ` Prabhakar Mahadev Lad
2022-01-29 21:05 ` Pavel Machek
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=TYAPR01MB625274BC4EFFA92D99EF211792209@TYAPR01MB6252.jpnprd01.prod.outlook.com \
--to=nobuhiro1.iwamatsu@toshiba.co.jp \
--cc=biju.das.jz@bp.renesas.com \
--cc=cip-dev@lists.cip-project.org \
--cc=pavel@denx.de \
--cc=prabhakar.mahadev-lad.rj@bp.renesas.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.