Re: [PATCH 2/4] powerpc/vas: Fix cleanup when VAS is not configured

From: Michael Ellerman
Date: Mon Feb 12 2018 - 00:24:01 EST


Sukadev Bhattiprolu <sukadev@xxxxxxxxxxxxxxxxxx> writes:

> When VAS is not configured in the system, make sure to remove
> the VAS debugfs directory and unregister the platform driver.
>
> Signed-off-by: Sukadev Bhattiprolu <sukadev@xxxxxxxxxxxxxxxxxx>
...
> diff --git a/arch/powerpc/platforms/powernv/vas.c b/arch/powerpc/platforms/powernv/vas.c
> index aebbe95..f83e27d8 100644
> --- a/arch/powerpc/platforms/powernv/vas.c
> +++ b/arch/powerpc/platforms/powernv/vas.c
> @@ -169,8 +169,11 @@ static int __init vas_init(void)
> found++;
> }
>
> - if (!found)
> + if (!found) {
> + platform_driver_unregister(&vas_driver);
> + vas_cleanup_dbgdir();
> return -ENODEV;
> + }

The better patch would be to move the call to vas_init_dbgdir() down
here, where we know we have successfully registered the driver.

cheers