Found by Linux Device Drivers Verification (Svace detector)
Remove unused NULL pointer check.
Signed-off-by: Alexander Strakh <str...@ispras.ru>
---
diff --git a/./0000/drivers/net/3c507.c b/./moder/drivers/net/3c507.c
index fbc2311..3bfb3dd 100644
--- a/./0000/drivers/net/3c507.c
+++ b/./moder/drivers/net/3c507.c
@@ -552,12 +552,6 @@ static irqreturn_t el16_interrupt(int irq, void *dev_id)
ushort ack_cmd = 0;
void __iomem *shmem;
- if (dev == NULL) {
- pr_err("%s: net_interrupt(): irq %d for unknown device.\n",
- dev->name, irq);
- return IRQ_NONE;
- }
-
ioaddr = dev->base_addr;
lp = netdev_priv(dev);
shmem = lp->base;
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majo...@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
You are obviously doing more than that ...
>
> Signed-off-by: Alexander Strakh <str...@ispras.ru>
>
> ---
> diff --git a/./0000/drivers/net/3c507.c b/./moder/drivers/net/3c507.c
> index fbc2311..3bfb3dd 100644
> --- a/./0000/drivers/net/3c507.c
> +++ b/./moder/drivers/net/3c507.c
> @@ -552,12 +552,6 @@ static irqreturn_t el16_interrupt(int irq, void *dev_id)
> ushort ack_cmd = 0;
> void __iomem *shmem;
>
> - if (dev == NULL) {
> - pr_err("%s: net_interrupt(): irq %d for unknown device.\n",
> - dev->name, irq);
You are changing real funcionality here!
If you want to fix it, fix the pr_err() but do not remove the "return
IRQ_NONE" entirely.
This looks like an introduction of a bug.
Regards,
Oliver
> - return IRQ_NONE;
> - }
> -
--
Interrupts will never be called with third parameter of NULL. It is really
bogus impossible to reach code.
--
>
> Interrupts will never be called with third parameter of NULL. It is really
> bogus impossible to reach code.
>
You're right! I just did not verify the direct assignment of dev = dev_id ...
Btw. the description for the reason of this patch remains unsuitably as the
problem is not the potential dereferencing of dev->name in pr_err() here.
It should better be something like this (partly stolen from your answer):
Interrupts will never be called with dev_id parameter of NULL.
This patch removes the obsolete, unreachable code.
Regards,
Oliver