6.13-stable review patch. If anyone has any objections, please let me know. ------------------ From: Thomas Weißschuh <thomas.weissschuh@xxxxxxxxxxxxx> 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@xxxxxxxxxxxxxxx Signed-off-by: Thomas Weißschuh <thomas.weissschuh@xxxxxxxxxxxxx> Acked-by: Richard Cochran <richardcochran@xxxxxxxxx> Reviewed-by: David Woodhouse <dwmw@xxxxxxxxxxxx> Signed-off-by: Paolo Abeni <pabeni@xxxxxxxxxx> Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx> --- drivers/ptp/ptp_vmclock.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) --- a/drivers/ptp/ptp_vmclock.c +++ b/drivers/ptp/ptp_vmclock.c @@ -547,6 +547,8 @@ static int vmclock_probe(struct platform 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 * 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;