LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* [PATCH] driver core: show the error number when driver_sysfs_add() fails
@ 2019-06-04 4:15 Kefeng Wang
2019-06-04 5:33 ` Greg Kroah-Hartman
0 siblings, 1 reply; 3+ messages in thread
From: Kefeng Wang @ 2019-06-04 4:15 UTC (permalink / raw)
To: Greg Kroah-Hartman, Rafael J. Wysocki; +Cc: linux-kernel, Kefeng Wang
If driver_sysfs_add() fails, kernel shows following message,
really_probe: driver_sysfs_add(portman.0) failed
ppdev: probe of portman.0 failed with error 0
It's better to show the error number like other probe_failed path.
Signed-off-by: Kefeng Wang <wangkefeng.wang@huawei.com>
---
drivers/base/dd.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/base/dd.c b/drivers/base/dd.c
index 0df9b4461766..04ee4e196530 100644
--- a/drivers/base/dd.c
+++ b/drivers/base/dd.c
@@ -493,7 +493,8 @@ static int really_probe(struct device *dev, struct device_driver *drv)
goto probe_failed;
}
- if (driver_sysfs_add(dev)) {
+ ret = driver_sysfs_add(dev);
+ if (ret) {
printk(KERN_ERR "%s: driver_sysfs_add(%s) failed\n",
__func__, dev_name(dev));
goto probe_failed;
--
2.20.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] driver core: show the error number when driver_sysfs_add() fails
2019-06-04 4:15 [PATCH] driver core: show the error number when driver_sysfs_add() fails Kefeng Wang
@ 2019-06-04 5:33 ` Greg Kroah-Hartman
2019-06-04 6:37 ` Kefeng Wang
0 siblings, 1 reply; 3+ messages in thread
From: Greg Kroah-Hartman @ 2019-06-04 5:33 UTC (permalink / raw)
To: Kefeng Wang; +Cc: Rafael J. Wysocki, linux-kernel
On Tue, Jun 04, 2019 at 12:15:46PM +0800, Kefeng Wang wrote:
> If driver_sysfs_add() fails, kernel shows following message,
>
> really_probe: driver_sysfs_add(portman.0) failed
> ppdev: probe of portman.0 failed with error 0
>
> It's better to show the error number like other probe_failed path.
>
> Signed-off-by: Kefeng Wang <wangkefeng.wang@huawei.com>
> ---
> drivers/base/dd.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/base/dd.c b/drivers/base/dd.c
> index 0df9b4461766..04ee4e196530 100644
> --- a/drivers/base/dd.c
> +++ b/drivers/base/dd.c
> @@ -493,7 +493,8 @@ static int really_probe(struct device *dev, struct device_driver *drv)
> goto probe_failed;
> }
>
> - if (driver_sysfs_add(dev)) {
> + ret = driver_sysfs_add(dev);
> + if (ret) {
> printk(KERN_ERR "%s: driver_sysfs_add(%s) failed\n",
> __func__, dev_name(dev));
Shouldn't this be where the error number is shown? No need for all
callers to also show the same thing.
thanks,
greg k-h
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] driver core: show the error number when driver_sysfs_add() fails
2019-06-04 5:33 ` Greg Kroah-Hartman
@ 2019-06-04 6:37 ` Kefeng Wang
0 siblings, 0 replies; 3+ messages in thread
From: Kefeng Wang @ 2019-06-04 6:37 UTC (permalink / raw)
To: Greg Kroah-Hartman; +Cc: Rafael J. Wysocki, linux-kernel
On 2019/6/4 13:33, Greg Kroah-Hartman wrote:
> On Tue, Jun 04, 2019 at 12:15:46PM +0800, Kefeng Wang wrote:
>> If driver_sysfs_add() fails, kernel shows following message,
>>
>> really_probe: driver_sysfs_add(portman.0) failed
>> ppdev: probe of portman.0 failed with error 0
>>
>> It's better to show the error number like other probe_failed path.
>>
>> Signed-off-by: Kefeng Wang <wangkefeng.wang@huawei.com>
>> ---
>> drivers/base/dd.c | 3 ++-
>> 1 file changed, 2 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/base/dd.c b/drivers/base/dd.c
>> index 0df9b4461766..04ee4e196530 100644
>> --- a/drivers/base/dd.c
>> +++ b/drivers/base/dd.c
>> @@ -493,7 +493,8 @@ static int really_probe(struct device *dev, struct device_driver *drv)
>> goto probe_failed;
>> }
>>
>> - if (driver_sysfs_add(dev)) {
>> + ret = driver_sysfs_add(dev);
>> + if (ret) {
>> printk(KERN_ERR "%s: driver_sysfs_add(%s) failed\n",
>> __func__, dev_name(dev));
> Shouldn't this be where the error number is shown? No need for all
> callers to also show the same thing.
Like the message shown as above, there is a common path to show all the probe error info,
"ppdev: probe of portman.0 failed with error 0"
but the driver_sysfs_add() error handling won't fill with ret, so error '0' is shown.
after this patch,
really_probe: driver_sysfs_add(portman.0) failed
ppdev: probe of portman.0 failed with error -12
>
> thanks,
>
> greg k-h
>
> .
>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2019-06-04 6:40 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-06-04 4:15 [PATCH] driver core: show the error number when driver_sysfs_add() fails Kefeng Wang
2019-06-04 5:33 ` Greg Kroah-Hartman
2019-06-04 6:37 ` Kefeng Wang
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).