linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v3 0/2] Fix return value check
@ 2020-07-10  9:30 Lu Wei
  2020-07-10  9:30 ` [PATCH v3 1/2] intel-hid: Fix return value check in check_acpi_dev() Lu Wei
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Lu Wei @ 2020-07-10  9:30 UTC (permalink / raw)
  To: alex.hung, dvhart, andy, platform-driver-x86, linux-kernel,
	acelan.kao, andy.shevchenko, luwei32

In the function check_acpi_dev(), if it fails to create
platform device, the return value is ERR_PTR() or NULL.
Thus it must use IS_ERR_OR_NULL to check return value.

---
v2->v3
- Modify format
v3->v4
- Change commit number to 12 characters

Lu Wei (2):
  intel-hid: Fix return value check in check_acpi_dev()
  intel-vbtn: Fix return value check in check_acpi_dev()

 drivers/platform/x86/intel-hid.c  | 2 +-
 drivers/platform/x86/intel-vbtn.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

--
2.7.4


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH v3 1/2] intel-hid: Fix return value check in check_acpi_dev()
  2020-07-10  9:30 [PATCH v3 0/2] Fix return value check Lu Wei
@ 2020-07-10  9:30 ` Lu Wei
  2020-07-10  9:30 ` [PATCH v3 2/2] intel-vbtn: " Lu Wei
  2020-07-10 20:37 ` [PATCH v3 0/2] Fix return value check Andy Shevchenko
  2 siblings, 0 replies; 5+ messages in thread
From: Lu Wei @ 2020-07-10  9:30 UTC (permalink / raw)
  To: alex.hung, dvhart, andy, platform-driver-x86, linux-kernel,
	acelan.kao, andy.shevchenko, luwei32

In the function check_acpi_dev(), if it fails to create
platform device, the return value is ERR_PTR() or NULL.
Thus it must use IS_ERR_OR_NULL to check return value.

Fixes: ecc83e52b28c ("intel-hid: new hid event driver for hotkeys")
Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Lu Wei <luwei32@huawei.com>
---

 drivers/platform/x86/intel-hid.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/platform/x86/intel-hid.c b/drivers/platform/x86/intel-hid.c
index cc7dd4d..c45250c 100644
--- a/drivers/platform/x86/intel-hid.c
+++ b/drivers/platform/x86/intel-hid.c
@@ -564,7 +564,7 @@ check_acpi_dev(acpi_handle handle, u32 lvl, void *context, void **rv)
 		return AE_OK;

 	if (acpi_match_device_ids(dev, ids) == 0)
-		if (acpi_create_platform_device(dev, NULL))
+		if (!IS_ERR_OR_NULL(acpi_create_platform_device(dev, NULL)))
 			dev_info(&dev->dev,
 				 "intel-hid: created platform device\n");

--
2.7.4


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH v3 2/2] intel-vbtn: Fix return value check in check_acpi_dev()
  2020-07-10  9:30 [PATCH v3 0/2] Fix return value check Lu Wei
  2020-07-10  9:30 ` [PATCH v3 1/2] intel-hid: Fix return value check in check_acpi_dev() Lu Wei
@ 2020-07-10  9:30 ` Lu Wei
  2020-07-10 20:37 ` [PATCH v3 0/2] Fix return value check Andy Shevchenko
  2 siblings, 0 replies; 5+ messages in thread
From: Lu Wei @ 2020-07-10  9:30 UTC (permalink / raw)
  To: alex.hung, dvhart, andy, platform-driver-x86, linux-kernel,
	acelan.kao, andy.shevchenko, luwei32

In the function check_acpi_dev(), if it fails to create
platform device, the return value is ERR_PTR() or NULL.
Thus it must use IS_ERR_OR_NULL to check return value.

Fixes: 332e081225fc ("intel-vbtn: new driver for Intel Virtual Button")
Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Lu Wei <luwei32@huawei.com>
---

 drivers/platform/x86/intel-vbtn.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/platform/x86/intel-vbtn.c b/drivers/platform/x86/intel-vbtn.c
index b588093..e1aa526 100644
--- a/drivers/platform/x86/intel-vbtn.c
+++ b/drivers/platform/x86/intel-vbtn.c
@@ -251,7 +251,7 @@ check_acpi_dev(acpi_handle handle, u32 lvl, void *context, void **rv)
 		return AE_OK;

 	if (acpi_match_device_ids(dev, ids) == 0)
-		if (acpi_create_platform_device(dev, NULL))
+		if (!IS_ERR_OR_NULL(acpi_create_platform_device(dev, NULL)))
 			dev_info(&dev->dev,
 				 "intel-vbtn: created platform device\n");

--
2.7.4


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH v3 0/2] Fix return value check
  2020-07-10  9:30 [PATCH v3 0/2] Fix return value check Lu Wei
  2020-07-10  9:30 ` [PATCH v3 1/2] intel-hid: Fix return value check in check_acpi_dev() Lu Wei
  2020-07-10  9:30 ` [PATCH v3 2/2] intel-vbtn: " Lu Wei
@ 2020-07-10 20:37 ` Andy Shevchenko
  2 siblings, 0 replies; 5+ messages in thread
From: Andy Shevchenko @ 2020-07-10 20:37 UTC (permalink / raw)
  To: Lu Wei
  Cc: Alex Hung, Darren Hart, Andy Shevchenko, Platform Driver,
	Linux Kernel Mailing List, AceLan Kao

On Fri, Jul 10, 2020 at 12:28 PM Lu Wei <luwei32@huawei.com> wrote:
>
> In the function check_acpi_dev(), if it fails to create
> platform device, the return value is ERR_PTR() or NULL.
> Thus it must use IS_ERR_OR_NULL to check return value.
>

Pushed to my review and testing queue, thanks!

> ---
> v2->v3
> - Modify format
> v3->v4
> - Change commit number to 12 characters
>
> Lu Wei (2):
>   intel-hid: Fix return value check in check_acpi_dev()
>   intel-vbtn: Fix return value check in check_acpi_dev()
>
>  drivers/platform/x86/intel-hid.c  | 2 +-
>  drivers/platform/x86/intel-vbtn.c | 2 +-
>  2 files changed, 2 insertions(+), 2 deletions(-)
>
> --
> 2.7.4
>


-- 
With Best Regards,
Andy Shevchenko

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH v3 0/2] Fix return value check
@ 2020-07-10  9:04 Lu Wei
  0 siblings, 0 replies; 5+ messages in thread
From: Lu Wei @ 2020-07-10  9:04 UTC (permalink / raw)
  To: alex.hung, dvhart, andy, platform-driver-x86, linux-kernel,
	acelan.kao, andy.shevchenko, luwei32

In the function check_acpi_dev(), if it fails to create
platform device, the return value is ERR_PTR() or NULL.
Thus it must use IS_ERR_OR_NULL to check return value.

*** BLURB HERE ***

Lu Wei (2):
  intel-hid: Fix return value check in check_acpi_dev()
  intel-vbtn: Fix return value check in check_acpi_dev()

 drivers/platform/x86/intel-hid.c  | 2 +-
 drivers/platform/x86/intel-vbtn.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

-- 
2.7.4


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2020-07-10 20:38 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-10  9:30 [PATCH v3 0/2] Fix return value check Lu Wei
2020-07-10  9:30 ` [PATCH v3 1/2] intel-hid: Fix return value check in check_acpi_dev() Lu Wei
2020-07-10  9:30 ` [PATCH v3 2/2] intel-vbtn: " Lu Wei
2020-07-10 20:37 ` [PATCH v3 0/2] Fix return value check Andy Shevchenko
  -- strict thread matches above, loose matches on Subject: below --
2020-07-10  9:04 Lu Wei

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).