Re: [PATCH] char: misc: add missing #ifdef CONFIG_PROC_FS and error checking

From: Greg KH
Date: Mon Jul 29 2024 - 05:43:49 EST


On Mon, Jul 29, 2024 at 03:35:11PM +0800, zhangjiao2 wrote:
> From: Zhang Jiao <zhangjiao2@xxxxxxxxxxxxxxxxxxxx>
>
> Add "#ifdef CONFIG_PROC_FS" to control misc proc create
> and give some error checking.
>
> Signed-off-by: Zhang Jiao <zhangjiao2@xxxxxxxxxxxxxxxxxxxx>
> ---
> drivers/char/misc.c | 8 ++++++++
> 1 file changed, 8 insertions(+)
>
> diff --git a/drivers/char/misc.c b/drivers/char/misc.c
> index 541edc26ec89..0370d53f368a 100644
> --- a/drivers/char/misc.c
> +++ b/drivers/char/misc.c
> @@ -286,9 +286,15 @@ EXPORT_SYMBOL(misc_deregister);
> static int __init misc_init(void)
> {
> int err;
> +#ifdef CONFIG_PROC_FS

We should almost never have #ifdef in .c files, please don't do that
here either.

Also, why is this suddenly a new issue?

And, when you have "and" in a changelog text, that's a huge hint you
need to split things up into multiple patches, please do that here.

thanks,

greg k-h