* [PATCH 1/3] staging: usbip: stub_main: correctly handle return value
@ 2013-09-10 5:14 navin patidar
2013-09-10 20:47 ` Dan Carpenter
0 siblings, 1 reply; 2+ messages in thread
From: navin patidar @ 2013-09-10 5:14 UTC (permalink / raw)
To: gregkh; +Cc: mfm, linux-usb, devel, linux-kernel, navin patidar
ret == 0 means success, anything else is failure.
Signed-off-by: navin patidar <navinp@cdac.in>
---
drivers/staging/usbip/stub_main.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/staging/usbip/stub_main.c b/drivers/staging/usbip/stub_main.c
index 33027cc..baf857f 100644
--- a/drivers/staging/usbip/stub_main.c
+++ b/drivers/staging/usbip/stub_main.c
@@ -255,14 +255,14 @@ static int __init usbip_host_init(void)
}
ret = usb_register(&stub_driver);
- if (ret < 0) {
+ if (ret) {
pr_err("usb_register failed %d\n", ret);
goto err_usb_register;
}
ret = driver_create_file(&stub_driver.drvwrap.driver,
&driver_attr_match_busid);
- if (ret < 0) {
+ if (ret) {
pr_err("driver_create_file failed\n");
goto err_create_file;
}
--
1.7.10.4
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH 1/3] staging: usbip: stub_main: correctly handle return value
2013-09-10 5:14 [PATCH 1/3] staging: usbip: stub_main: correctly handle return value navin patidar
@ 2013-09-10 20:47 ` Dan Carpenter
0 siblings, 0 replies; 2+ messages in thread
From: Dan Carpenter @ 2013-09-10 20:47 UTC (permalink / raw)
To: navin patidar; +Cc: gregkh, mfm, devel, linux-usb, linux-kernel
On Tue, Sep 10, 2013 at 10:44:07AM +0530, navin patidar wrote:
> ret == 0 means success, anything else is failure.
>
Hopefully, it's only returning negative error codes. Otherwise it needs
a different fix.
There isn't an official kernel style on if "if (ret < 0)" is better than
"if (ret)". Some subsystems have a preference but most don't care.
It's up to the maintainer to choose.
Your patch is fine, but the changelog is misleading. It should just say
"I prefer the other style" instead of "This code is wrong and has buggy
error handling".
regards,
dan carpenter
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2013-09-10 20:51 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-09-10 5:14 [PATCH 1/3] staging: usbip: stub_main: correctly handle return value navin patidar
2013-09-10 20:47 ` Dan Carpenter
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox