summaryrefslogtreecommitdiff
path: root/drivers/ptp
diff options
context:
space:
mode:
authorThomas Weißschuh <thomas.weissschuh@linutronix.de>2025-02-07 10:39:04 +0100
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2025-02-21 14:11:09 +0100
commita66c7093e940e0b8a4c4ba4e74d56fe1e8bf1a3e (patch)
treec534fb8eb11608fec5d99f2c83277e7f654b77db /drivers/ptp
parent7344f5777d7c29229ba8ca749f92a5de07ea918a (diff)
downloadlinux-a66c7093e940e0b8a4c4ba4e74d56fe1e8bf1a3e.tar.gz
linux-a66c7093e940e0b8a4c4ba4e74d56fe1e8bf1a3e.tar.bz2
linux-a66c7093e940e0b8a4c4ba4e74d56fe1e8bf1a3e.zip
ptp: vmclock: Don't unregister misc device if it was not registered
commit 39e926c3a21b25af6cae479fbb752f193240ce03 upstream. vmclock_remove() tries to detect the successful registration of the misc device based on the value of its minor value. However that check is incorrect if the misc device registration was not attempted in the first place. Always initialize the minor number, so the check works properly. 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> Acked-by: Richard Cochran <richardcochran@gmail.com> Reviewed-by: David Woodhouse <dwmw@amazon.co.uk> Signed-off-by: Paolo Abeni <pabeni@redhat.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/ptp')
-rw-r--r--drivers/ptp/ptp_vmclock.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/ptp/ptp_vmclock.c b/drivers/ptp/ptp_vmclock.c
index 0a2cfc8ad3c5..c070c9d5acf9 100644
--- a/drivers/ptp/ptp_vmclock.c
+++ b/drivers/ptp/ptp_vmclock.c
@@ -547,6 +547,8 @@ static int vmclock_probe(struct platform_device *pdev)
goto out;
}
+ st->miscdev.minor = MISC_DYNAMIC_MINOR;
+
/*
* If the structure is big enough, it can be mapped to userspace.
* Theoretically a guest OS even using larger pages could still
@@ -554,7 +556,6 @@ static int vmclock_probe(struct platform_device *pdev)
* cross that bridge if/when we come to it.
*/
if (le32_to_cpu(st->clk->size) >= PAGE_SIZE) {
- st->miscdev.minor = MISC_DYNAMIC_MINOR;
st->miscdev.fops = &vmclock_miscdev_fops;
st->miscdev.name = st->name;