netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Mateusz Polchlopek <mateusz.polchlopek@intel.com>
To: "Thomas Weißschuh" <thomas.weissschuh@linutronix.de>,
	"David Woodhouse" <dwmw2@infradead.org>,
	"Richard Cochran" <richardcochran@gmail.com>,
	"Andrew Lunn" <andrew+netdev@lunn.ch>,
	"David S. Miller" <davem@davemloft.net>,
	"Eric Dumazet" <edumazet@google.com>,
	"Jakub Kicinski" <kuba@kernel.org>,
	"Paolo Abeni" <pabeni@redhat.com>
Cc: David Woodhouse <dwmw@amazon.co.uk>, <netdev@vger.kernel.org>,
	<linux-kernel@vger.kernel.org>, <stable@vger.kernel.org>
Subject: Re: [PATCH net-next 1/4] ptp: vmclock: Set driver data before its usage
Date: Fri, 7 Feb 2025 08:07:07 +0100	[thread overview]
Message-ID: <bee6e7db-80ec-4150-900e-e3d42938ceed@intel.com> (raw)
In-Reply-To: <20250206-vmclock-probe-v1-1-17a3ea07be34@linutronix.de>



On 2/6/2025 6:45 PM, Thomas Weißschuh wrote:
> If vmlock_ptp_register() fails during probing, vmclock_remove() is

Typo: you missed 'c' in function name - vmclock_ptp_register

> called to clean up the ptp clock and misc device.
> It uses dev_get_drvdata() to access the vmclock state.
> However the driver data is not yet set at this point.
> 
> Assign the driver data earlier.
> 
> Fixes: 205032724226 ("ptp: Add support for the AMZNC10C 'vmclock' device")
> Cc: stable@vger.kernel.org
> Signed-off-by: Thomas Weißschuh <thomas.weissschuh@linutronix.de>
> ---
>   drivers/ptp/ptp_vmclock.c | 4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/ptp/ptp_vmclock.c b/drivers/ptp/ptp_vmclock.c
> index 0a2cfc8ad3c5408a87fd8fedeff274ab895de3dd..1920698ae6eba6abfff5b61afae1b047910026fd 100644
> --- a/drivers/ptp/ptp_vmclock.c
> +++ b/drivers/ptp/ptp_vmclock.c
> @@ -524,6 +524,8 @@ static int vmclock_probe(struct platform_device *pdev)
>   		goto out;
>   	}
>   
> +	dev_set_drvdata(dev, st);
> +
>   	if (le32_to_cpu(st->clk->magic) != VMCLOCK_MAGIC ||
>   	    le32_to_cpu(st->clk->size) > resource_size(&st->res) ||
>   	    le16_to_cpu(st->clk->version) != 1) {
> @@ -587,8 +589,6 @@ static int vmclock_probe(struct platform_device *pdev)
>   		 (st->miscdev.minor && st->ptp_clock) ? ", " : "",
>   		 st->ptp_clock ? "PTP" : "");
>   
> -	dev_set_drvdata(dev, st);
> -
>    out:
>   	return ret;
>   }
> 

Nice catch! The code looks good but please fix the typo in the
commit msg, as this may be misleading. When applied please add my:

Reviewed-by: Mateusz Polchlopek <mateusz.polchlopek@intel.com>

  reply	other threads:[~2025-02-07  7:07 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-02-06 17:45 [PATCH net-next 0/4] ptp: vmclock: bugfixes and cleanups for error handling Thomas Weißschuh
2025-02-06 17:45 ` [PATCH net-next 1/4] ptp: vmclock: Set driver data before its usage Thomas Weißschuh
2025-02-07  7:07   ` Mateusz Polchlopek [this message]
2025-02-06 17:45 ` [PATCH net-next 2/4] ptp: vmclock: Don't unregister misc device if it was not registered Thomas Weißschuh
2025-02-06 17:45 ` [PATCH net-next 3/4] ptp: vmclock: Clean up miscdev and ptp clock through devres Thomas Weißschuh
2025-02-06 17:45 ` [PATCH net-next 4/4] ptp: vmclock: Remove goto-based cleanup logic Thomas Weißschuh
2025-02-07  5:43 ` [PATCH net-next 0/4] ptp: vmclock: bugfixes and cleanups for error handling Richard Cochran
2025-02-07  7:13 ` Mateusz Polchlopek
2025-02-07  9:10   ` David Woodhouse
2025-02-07  9:25     ` Thomas Weißschuh
2025-02-07  9:29       ` David Woodhouse
2025-02-07  9:13 ` [PATCH net-next 5/4] ptp: vmclock: Add .owner to vmclock_miscdev_fops David Woodhouse

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=bee6e7db-80ec-4150-900e-e3d42938ceed@intel.com \
    --to=mateusz.polchlopek@intel.com \
    --cc=andrew+netdev@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=dwmw2@infradead.org \
    --cc=dwmw@amazon.co.uk \
    --cc=edumazet@google.com \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=richardcochran@gmail.com \
    --cc=stable@vger.kernel.org \
    --cc=thomas.weissschuh@linutronix.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).