[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <bee6e7db-80ec-4150-900e-e3d42938ceed@intel.com>
Date: Fri, 7 Feb 2025 08:07:07 +0100
From: Mateusz Polchlopek <mateusz.polchlopek@...el.com>
To: Thomas Weißschuh <thomas.weissschuh@...utronix.de>,
"David Woodhouse" <dwmw2@...radead.org>, Richard Cochran
<richardcochran@...il.com>, Andrew Lunn <andrew+netdev@...n.ch>, "David S.
Miller" <davem@...emloft.net>, Eric Dumazet <edumazet@...gle.com>, Jakub
Kicinski <kuba@...nel.org>, "Paolo Abeni" <pabeni@...hat.com>
CC: David Woodhouse <dwmw@...zon.co.uk>, <netdev@...r.kernel.org>,
<linux-kernel@...r.kernel.org>, <stable@...r.kernel.org>
Subject: Re: [PATCH net-next 1/4] ptp: vmclock: Set driver data before its
usage
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@...r.kernel.org
> Signed-off-by: Thomas Weißschuh <thomas.weissschuh@...utronix.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@...el.com>
Powered by blists - more mailing lists