Skip to contentSkip to conversation

driver-core: fix odd_ptr_err.cocci warnings

PATCH In review Julia Lawall 2 participants 3 messages Nov 10, 2016 1 message not in the archive Driver core

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 driver-core: fix odd_ptr_err.cocci warnings

PTR_ERR should access the value just tested by IS_ERR

Generated by: scripts/coccinelle/tests/odd_ptr_err.cocci

---

0-day warning related to the following commit:

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core.git driver-core-testing
head:   dfea747d2aba77443acf7ce6fa37caa729bd034c
commit: 79543cf2b18ea4a35f8864849d7ad8882ea8a23d [10/14] driver-core: add test module for asynchronous probing

I haven't checked the context in detail.

 test_async_driver_probe.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/base/test/test_async_driver_probe.c +1 -1
@@ -119,7 +119,7 @@ static int __init test_async_probe_init(
 	sync_dev_1 = platform_device_register_simple("test_sync_driver", 1,
 						     NULL, 0);
 	if (IS_ERR(async_dev_1)) {
-		error = PTR_ERR(sync_dev_1);
+		error = PTR_ERR(async_dev_1);
 		pr_err("failed to create sync_dev_1: %d", error);
 		goto err_unregister_sync_driver;
 	}

A message that is not in the archive (sent off-list or not yet received): CAE_wzQ_st6sBugdFRGX8VgSXcRqNCo3QcPwr5B8XpR-cQft6Eg@mail.gmail.com

#2 lore raw

[ resending as plain text ]

Quoted 47 lines · Dmitry Torokhov
Quoted 28 lines · Julia Lawall

PTR_ERR should access the value just tested by IS_ERR

Generated by: scripts/coccinelle/tests/odd_ptr_err.cocci

---

0-day warning related to the following commit:

tree:
https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core.git
driver-core-testing

head:   dfea747d2aba77443acf7ce6fa37caa729bd034c
commit: 79543cf2b18ea4a35f8864849d7ad8882ea8a23d [10/14] driver-core: add

test module for asynchronous probing

I haven't checked the context in detail.

 test_async_driver_probe.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

drivers/base/test/test_async_driver_probe.c static int __init test_async_probe_init( · line 123

Quoted 6 lines
drivers/base/test/test_async_driver_probe.c +1 -1
@@ -119,7 +119,7 @@ static int __init test_async_probe_init(
        sync_dev_1 = platform_device_register_simple("test_sync_driver",
 1,
                                                     NULL, 0);
        if (IS_ERR(async_dev_1)) {
-               error = PTR_ERR(sync_dev_1);
+               error = PTR_ERR(async_dev_1);

NAK. It should be "if (IS_ERR(sync_dev_1)) {"

Quoted 4 lines
drivers/base/test/test_async_driver_probe.c +0 -0
                pr_err("failed to create sync_dev_1: %d", error);
                goto err_unregister_sync_driver;
        }
#3 lore raw
Quoted 43 lines · Dmitry Torokhov

[ resending as plain text ]

Quoted 40 lines · Dmitry Torokhov
Quoted 28 lines · Julia Lawall

PTR_ERR should access the value just tested by IS_ERR

Generated by: scripts/coccinelle/tests/odd_ptr_err.cocci

---

0-day warning related to the following commit:

tree:
https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core.git
driver-core-testing

head:   dfea747d2aba77443acf7ce6fa37caa729bd034c
commit: 79543cf2b18ea4a35f8864849d7ad8882ea8a23d [10/14] driver-core: add

test module for asynchronous probing

I haven't checked the context in detail.

 test_async_driver_probe.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

drivers/base/test/test_async_driver_probe.c static int __init test_async_probe_init( · line 123

Quoted 6 lines
drivers/base/test/test_async_driver_probe.c +1 -1
@@ -119,7 +119,7 @@ static int __init test_async_probe_init(
        sync_dev_1 = platform_device_register_simple("test_sync_driver",
 1,
                                                     NULL, 0);
        if (IS_ERR(async_dev_1)) {
-               error = PTR_ERR(sync_dev_1);
+               error = PTR_ERR(async_dev_1);

NAK. It should be "if (IS_ERR(sync_dev_1)) {"

Indeed, I should have noticed that. Will you make the fix, or should I revise the proposed patch?

julia

Quoted 8 lines
Quoted 7 lines
Quoted 5 lines
drivers/base/test/test_async_driver_probe.c +0 -0
                pr_err("failed to create sync_dev_1: %d", error);
                goto err_unregister_sync_driver;
        }