Linux kernel staging patches
 help / color / mirror / Atom feed
From: "gregkh@linuxfoundation.org" <gregkh@linuxfoundation.org>
To: Steven Davis <goldside000@outlook.com>
Cc: "johan@kernel.org" <johan@kernel.org>,
	"elder@kernel.org" <elder@kernel.org>,
	"greybus-dev@lists.linaro.dev" <greybus-dev@lists.linaro.dev>,
	"linux-staging@lists.linux.dev" <linux-staging@lists.linux.dev>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] staging: greybus: Log driver_register() failure
Date: Sun, 29 Dec 2024 11:19:55 +0100	[thread overview]
Message-ID: <2024122946-footer-neatness-aeb9@gregkh> (raw)
In-Reply-To: <20241228165720.16552-1-goldside000@outlook.com>

On Sat, Dec 28, 2024 at 04:57:44PM +0000, Steven Davis wrote:
> Currently, if driver_register() fails, it just returns retval
> and fails silently. This behavior may make the error more difficult
> to debug, as the error is not logged.
> 
> Adding pr_err() here will log the error descriptively, along with
> driver name and the value that retval returned. That way, the error
> is not silent and the user can see what happened.
> 
> Signed-off-by: Steven Davis <goldside000@outlook.com>
> ---
>  drivers/staging/greybus/gbphy.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/staging/greybus/gbphy.c b/drivers/staging/greybus/gbphy.c
> index 6adcad286..c6d1030b7 100644
> --- a/drivers/staging/greybus/gbphy.c
> +++ b/drivers/staging/greybus/gbphy.c
> @@ -204,8 +204,10 @@ int gb_gbphy_register_driver(struct gbphy_driver *driver,
>  	driver->driver.mod_name = mod_name;
>  
>  	retval = driver_register(&driver->driver);
> -	if (retval)
> +	if (retval) {
> +		pr_err("failed to register driver %s: %d\n", driver->name, retval);

Is this really an issue in real-world situations?  Have you run across
this where this failed and knowing the return value of driver_register()
helped out?

And if you are using this driver, great!  Let's get it cleaned up and
out of drivers/staging/ please!  Otherwise we really should just remove
them :(

thanks,

greg k-h

      reply	other threads:[~2024-12-29 10:20 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-12-28 16:57 [PATCH] staging: greybus: Log driver_register() failure Steven Davis
2024-12-29 10:19 ` gregkh [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=2024122946-footer-neatness-aeb9@gregkh \
    --to=gregkh@linuxfoundation.org \
    --cc=elder@kernel.org \
    --cc=goldside000@outlook.com \
    --cc=greybus-dev@lists.linaro.dev \
    --cc=johan@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-staging@lists.linux.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox