All of lore.kernel.org
 help / color / mirror / Atom feed
From: Prabhakar Mahadev Lad <prabhakar.mahadev-lad.rj@bp.renesas.com>
To: Pavel Machek <pavel@denx.de>
Cc: "cip-dev@lists.cip-project.org" <cip-dev@lists.cip-project.org>,
	Nobuhiro Iwamatsu <nobuhiro1.iwamatsu@toshiba.co.jp>,
	Biju Das <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:34:13 +0000	[thread overview]
Message-ID: <OSZPR01MB7019A1C696667D60C8F1EBF2AA209@OSZPR01MB7019.jpnprd01.prod.outlook.com> (raw)
In-Reply-To: <20220126221249.GB26019@duo.ucw.cz>

Hi Pavel,

Thank you for the review.

> -----Original Message-----
> From: Pavel Machek <pavel@denx.de>
> Sent: 26 January 2022 22:13
> To: Prabhakar Mahadev Lad <prabhakar.mahadev-lad.rj@bp.renesas.com>
> Cc: cip-dev@lists.cip-project.org; Nobuhiro Iwamatsu <nobuhiro1.iwamatsu@toshiba.co.jp>; Pavel Machek
> <pavel@denx.de>; Biju Das <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
> 
> Hi!
> 
> > 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.
> 
> Are they? I see fail label being unused in our 5.10 tree (but mainline uses it and I don't think we
> need it removed).
> 
It is being used [0].

> But more importantly... staring at the code some more:
> 
> 	err = register_candev(ndev);
> 	if (err) {
>                 dev_err(&pdev->dev,
> 	                "register_candev() failed, error %d\n", err);
> 	        goto fail_candev;
>         }
> 	spin_lock_init(&priv->tx_lock);
>         devm_can_led_init(ndev);
> 	gpriv->ch[priv->channel] = priv;
>         dev_info(&pdev->dev, "device registered (channel %u)\n", priv->channel)\ ;
> 	return 0;
> 
> Device is registered before being fully ready, and I don't see anything preventing the device from
> being used. Should register_candev be done last?
> 
Good catch, do agree register_candev() has to be done last.

> (And sorry for not noticing that earlier).
> 
No worries.


[0] https://git.kernel.org/pub/scm/linux/kernel/git/cip/linux-cip.git/tree/drivers/net/can/rcar/rcar_canfd.c?h=linux-5.10.y-cip#n1664

Cheers,
Prabhakar

> Best regards,
> 								Pavel
> --
> DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
> HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany


  reply	other threads:[~2022-01-26 22:34 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
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 [this message]
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=OSZPR01MB7019A1C696667D60C8F1EBF2AA209@OSZPR01MB7019.jpnprd01.prod.outlook.com \
    --to=prabhakar.mahadev-lad.rj@bp.renesas.com \
    --cc=biju.das.jz@bp.renesas.com \
    --cc=cip-dev@lists.cip-project.org \
    --cc=nobuhiro1.iwamatsu@toshiba.co.jp \
    --cc=pavel@denx.de \
    /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.