* [PATCH] platform/x86: remove useless comparisons in sony_pic_read_possible_resource()
@ 2022-07-19 11:03 Andrey Strachuk
2022-07-28 17:41 ` Hans de Goede
0 siblings, 1 reply; 2+ messages in thread
From: Andrey Strachuk @ 2022-07-19 11:03 UTC (permalink / raw)
To: Mattia Dongili
Cc: Andrey Strachuk, Hans de Goede, Mark Gross, Len Brown,
platform-driver-x86, linux-kernel, ldv-project
Local variable 'p' is initialized by an address
of field of acpi_resource structure, so it does
not make sense to compare 'p' with NULL.
Local variable 'io' is initialized by an address
of field of acpi_resource structure, so it does
not make sense to compare 'io' with NULL.
Found by Linux Verification Center (linuxtesting.org) with SVACE.
Signed-off-by: Andrey Strachuk <strochuk@ispras.ru>
Fixes: 41b16dce3905 ("create drivers/platform/x86/ from drivers/misc/")
---
drivers/platform/x86/sony-laptop.c | 7 +------
1 file changed, 1 insertion(+), 6 deletions(-)
diff --git a/drivers/platform/x86/sony-laptop.c b/drivers/platform/x86/sony-laptop.c
index d8d0c0bed5e9..07ef05f727a2 100644
--- a/drivers/platform/x86/sony-laptop.c
+++ b/drivers/platform/x86/sony-laptop.c
@@ -4341,7 +4341,7 @@ sony_pic_read_possible_resource(struct acpi_resource *resource, void *context)
{
struct acpi_resource_irq *p = &resource->data.irq;
struct sony_pic_irq *interrupt = NULL;
- if (!p || !p->interrupt_count) {
+ if (!p->interrupt_count) {
/*
* IRQ descriptors may have no IRQ# bits set,
* particularly those those w/ _STA disabled
@@ -4374,11 +4374,6 @@ sony_pic_read_possible_resource(struct acpi_resource *resource, void *context)
struct acpi_resource_io *io = &resource->data.io;
struct sony_pic_ioport *ioport =
list_first_entry(&dev->ioports, struct sony_pic_ioport, list);
- if (!io) {
- dprintk("Blank IO resource\n");
- return AE_OK;
- }
-
if (!ioport->io1.minimum) {
memcpy(&ioport->io1, io, sizeof(*io));
dprintk("IO1 at 0x%.4x (0x%.2x)\n", ioport->io1.minimum,
--
2.25.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] platform/x86: remove useless comparisons in sony_pic_read_possible_resource()
2022-07-19 11:03 [PATCH] platform/x86: remove useless comparisons in sony_pic_read_possible_resource() Andrey Strachuk
@ 2022-07-28 17:41 ` Hans de Goede
0 siblings, 0 replies; 2+ messages in thread
From: Hans de Goede @ 2022-07-28 17:41 UTC (permalink / raw)
To: Andrey Strachuk, Mattia Dongili
Cc: Mark Gross, Len Brown, platform-driver-x86, linux-kernel, ldv-project
Hi,
On 7/19/22 13:03, Andrey Strachuk wrote:
> Local variable 'p' is initialized by an address
> of field of acpi_resource structure, so it does
> not make sense to compare 'p' with NULL.
>
> Local variable 'io' is initialized by an address
> of field of acpi_resource structure, so it does
> not make sense to compare 'io' with NULL.
>
> Found by Linux Verification Center (linuxtesting.org) with SVACE.
>
> Signed-off-by: Andrey Strachuk <strochuk@ispras.ru>
> Fixes: 41b16dce3905 ("create drivers/platform/x86/ from drivers/misc/")
Thank you for your patch, I've applied this patch (minus the
invalid fixes tag) to my review-hans branch:
https://git.kernel.org/pub/scm/linux/kernel/git/pdx86/platform-drivers-x86.git/log/?h=review-hans
Note it will show up in my review-hans branch once I've pushed my
local branch there, which might take a while.
Once I've run some tests on this branch the patches there will be
added to the platform-drivers-x86/for-next branch and eventually
will be included in the pdx86 pull-request to Linus for the next
merge-window.
Regards,
Hans
> ---
> drivers/platform/x86/sony-laptop.c | 7 +------
> 1 file changed, 1 insertion(+), 6 deletions(-)
>
> diff --git a/drivers/platform/x86/sony-laptop.c b/drivers/platform/x86/sony-laptop.c
> index d8d0c0bed5e9..07ef05f727a2 100644
> --- a/drivers/platform/x86/sony-laptop.c
> +++ b/drivers/platform/x86/sony-laptop.c
> @@ -4341,7 +4341,7 @@ sony_pic_read_possible_resource(struct acpi_resource *resource, void *context)
> {
> struct acpi_resource_irq *p = &resource->data.irq;
> struct sony_pic_irq *interrupt = NULL;
> - if (!p || !p->interrupt_count) {
> + if (!p->interrupt_count) {
> /*
> * IRQ descriptors may have no IRQ# bits set,
> * particularly those those w/ _STA disabled
> @@ -4374,11 +4374,6 @@ sony_pic_read_possible_resource(struct acpi_resource *resource, void *context)
> struct acpi_resource_io *io = &resource->data.io;
> struct sony_pic_ioport *ioport =
> list_first_entry(&dev->ioports, struct sony_pic_ioport, list);
> - if (!io) {
> - dprintk("Blank IO resource\n");
> - return AE_OK;
> - }
> -
> if (!ioport->io1.minimum) {
> memcpy(&ioport->io1, io, sizeof(*io));
> dprintk("IO1 at 0x%.4x (0x%.2x)\n", ioport->io1.minimum,
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2022-07-28 17:42 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-07-19 11:03 [PATCH] platform/x86: remove useless comparisons in sony_pic_read_possible_resource() Andrey Strachuk
2022-07-28 17:41 ` Hans de Goede
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).