driver core: switch to use dev_err_probe()
PATCH 1/1 driver core: switch to use dev_err_probe()
Use dev_err_probe() to simplify code and print error code.
--- drivers/base/core.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-)
drivers/base/core.c +3 -5
@@ -2507,11 +2507,9 @@ static ssize_t uevent_store(struct device *dev, struct device_attribute *attr,int rc; rc =kobject_synth_uevent (&dev->kobj, buf, count); - -if (rc) { -dev_err (dev,"uevent: failed to send synthetic uevent\n" ); -return rc; - } +if (rc) +return dev_err_probe (dev, rc, +"uevent: failed to send synthetic uevent\n" );return count; }
Signature · 1 line
2.25.1
Greg KH
maintainerQuoted 13 lines · Yang Yingliang
Use
dev_err_probe()to simplify code and print error code.Signed-off-by Yang Yingliang <[email protected]>--- drivers/base/core.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-)drivers/base/core.c +0
-0@@ -2507,11 +2507,9 @@ static ssize_t uevent_store(struct device *dev, struct device_attribute *attr,int rc;
drivers/base/core.c static ssize_t uevent_store(struct device *dev, struct device_attribute *attr, · line 2512
Quoted 10 lines
drivers/base/core.c +3
-5rc =kobject_synth_uevent (&dev->kobj, buf, count); - -if (rc) { -dev_err (dev,"uevent: failed to send synthetic uevent\n" ); -return rc; - } +if (rc) +return dev_err_probe (dev, rc, +"uevent: failed to send synthetic uevent\n" );
I do not understand this at all, this is not on the probe path at all, so why is this function needed?
Have you tested this? What was the resulting output before and after this change?
thanks,
greg k-h
Hi,
Quoted 27 lines · Greg KH
Quoted 13 lines · Yang Yingliang
Use
dev_err_probe()to simplify code and print error code.Signed-off-by Yang Yingliang <[email protected]>--- drivers/base/core.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-)drivers/base/core.c +0
-0@@ -2507,11 +2507,9 @@ static ssize_t uevent_store(struct device *dev, struct device_attribute *attr,int rc;drivers/base/core.c static ssize_t uevent_store(struct device *dev, struct device_attribute *attr, · line 2512
Quoted 10 lines
drivers/base/core.c +3
-5rc =kobject_synth_uevent (&dev->kobj, buf, count); - -if (rc) { -dev_err (dev,"uevent: failed to send synthetic uevent\n" ); -return rc; - } +if (rc) +return dev_err_probe (dev, rc, +"uevent: failed to send synthetic uevent\n" );I do not understand this at all, this is not on the probe path at all, so why is this function needed?
Quoted 2 lines
Have you tested this? What was the resulting output before and after this change?
Yes, after this change, the error code will be print.
Quoted 5 lines
thanks,
greg k-h
.
Greg KH
maintainerQuoted 29 lines · Yang Yingliang
Hi,
Quoted 26 lines · Greg KH
Quoted 12 lines · Yang Yingliang
Use
dev_err_probe()to simplify code and print error code.Signed-off-by Yang Yingliang <[email protected]>--- drivers/base/core.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-)drivers/base/core.c +0
-0drivers/base/core.c static ssize_t uevent_store(struct device *dev, struct device_attribute *attr, · line 2511
Quoted 10 lines
drivers/base/core.c +3
-5@@ -2507,11 +2507,9 @@ static ssize_t uevent_store(struct device *dev, struct device_attribute *attr,int rc; rc =kobject_synth_uevent (&dev->kobj, buf, count); - -if (rc) { -dev_err (dev,"uevent: failed to send synthetic uevent\n" ); -return rc; - } +if (rc) +return dev_err_probe (dev, rc, +"uevent: failed to send synthetic uevent\n" );I do not understand this at all, this is not on the probe path at all, so why is this function needed?
Quoted 3 lines
Quoted 2 lines
Have you tested this? What was the resulting output before and after this change?
Yes, after this change, the error code will be print.
You did not answer my question.
Again, this is not on the probe() callback path, so why are you wanting to call dev_err_probe()?
thanks,
greg k-h
Quoted 30 lines · Greg KH
Quoted 29 lines · Yang Yingliang
Hi,
Quoted 26 lines · Greg KH
Quoted 12 lines · Yang Yingliang
Use
dev_err_probe()to simplify code and print error code.Signed-off-by Yang Yingliang <[email protected]>--- drivers/base/core.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-)drivers/base/core.c +0
-0drivers/base/core.c static ssize_t uevent_store(struct device *dev, struct device_attribute *attr, · line 2511
Quoted 10 lines
drivers/base/core.c +3
-5@@ -2507,11 +2507,9 @@ static ssize_t uevent_store(struct device *dev, struct device_attribute *attr,int rc; rc =kobject_synth_uevent (&dev->kobj, buf, count); - -if (rc) { -dev_err (dev,"uevent: failed to send synthetic uevent\n" ); -return rc; - } +if (rc) +return dev_err_probe (dev, rc, +"uevent: failed to send synthetic uevent\n" );I do not understand this at all, this is not on the probe path at all, so why is this function needed?
Quoted 7 lines
Quoted 3 lines
Quoted 2 lines
Have you tested this? What was the resulting output before and after this change?
Yes, after this change, the error code will be print.
You did not answer my question.
Again, this is not on the
probe()callback path, so why are you wanting to calldev_err_probe()?
I was trying to simplify the code, I think I misuse the helper, you can ignore this patch.
Thanks,
Yang
Quoted 5 lines
thanks,
greg k-h
.