staging: greybus: Log driver_register() failure
PATCH 1/1 staging: greybus: Log driver_register() failure
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.
--- drivers/staging/greybus/gbphy.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/staging/greybus/gbphy.c +3 -1
@@ -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);return retval; + }pr_info ("registered new driver %s\n" , driver->name);return 0 ;
Signature · 1 line
2.39.5
[email protected]
maintainerQuoted 18 lines · Steven Davis
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 <[email protected]>--- drivers/staging/greybus/gbphy.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)drivers/staging/greybus/gbphy.c +0
-0
drivers/staging/greybus/gbphy.c int gb_gbphy_register_driver(struct gbphy_driver *driver, · line 208
Quoted 6 lines
drivers/staging/greybus/gbphy.c +2
-1@@ -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