Re: [PATCH] driver core: Add log when devtmpfs create node failed

From: Greg KH
Date: Wed May 22 2024 - 08:23:41 EST


On Wed, May 22, 2024 at 11:43:46AM +0000, Xingui Yang wrote:
> Currently, no exception information is output when devtmpfs create node
> failed, so add log info for it.

Why? Who is going to do something with this?

>
> Signed-off-by: Xingui Yang <yangxingui@xxxxxxxxxx>
> ---
> drivers/base/core.c | 5 ++++-
> 1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/base/core.c b/drivers/base/core.c
> index 5f4e03336e68..32a41e0472b2 100644
> --- a/drivers/base/core.c
> +++ b/drivers/base/core.c
> @@ -3691,7 +3691,10 @@ int device_add(struct device *dev)
> if (error)
> goto SysEntryError;
>
> - devtmpfs_create_node(dev);
> + error = devtmpfs_create_node(dev);
> + if (error)
> + pr_info("devtmpfs create node for %s failed: %d\n",
> + dev_name(dev), error);

Why is an error message pr_info()?

And again, why is this needed? If this needs to be checked, why are you
now checking it but ignoring the error?

What would this help with?

thanks,

greg k-h