* [PATCH -next] misc/pvpanic: fix return value check in pvpanic_pci_probe()
@ 2021-03-30 1:36 Qiheng Lin
2021-03-30 9:27 ` Andy Shevchenko
0 siblings, 1 reply; 2+ messages in thread
From: Qiheng Lin @ 2021-03-30 1:36 UTC (permalink / raw)
To: linqiheng, Arnd Bergmann, Greg Kroah-Hartman, Mihai Carabas,
Andy Shevchenko, zhenwei pi, Paolo Bonzini, Joe Perches,
Shile Zhang
Cc: linux-kernel, kernel-janitors, Hulk Robot
In case of error, the function pci_iomap() returns NULL pointer
not ERR_PTR(). The IS_ERR() test in the return value check
should be replaced with NULL test.
Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Qiheng Lin <linqiheng@huawei.com>
---
drivers/misc/pvpanic/pvpanic-pci.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/misc/pvpanic/pvpanic-pci.c b/drivers/misc/pvpanic/pvpanic-pci.c
index f38a80a5bbc8..9ecc4e8559d5 100644
--- a/drivers/misc/pvpanic/pvpanic-pci.c
+++ b/drivers/misc/pvpanic/pvpanic-pci.c
@@ -83,8 +83,8 @@ static int pvpanic_pci_probe(struct pci_dev *pdev,
return ret;
base = pci_iomap(pdev, 0, 0);
- if (IS_ERR(base))
- return PTR_ERR(base);
+ if (!base)
+ return -ENOMEM;
pi = kmalloc(sizeof(*pi), GFP_ATOMIC);
if (!pi)
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH -next] misc/pvpanic: fix return value check in pvpanic_pci_probe()
2021-03-30 1:36 [PATCH -next] misc/pvpanic: fix return value check in pvpanic_pci_probe() Qiheng Lin
@ 2021-03-30 9:27 ` Andy Shevchenko
0 siblings, 0 replies; 2+ messages in thread
From: Andy Shevchenko @ 2021-03-30 9:27 UTC (permalink / raw)
To: Qiheng Lin
Cc: Arnd Bergmann, Greg Kroah-Hartman, Mihai Carabas, zhenwei pi,
Paolo Bonzini, Joe Perches, Shile Zhang, linux-kernel,
kernel-janitors, Hulk Robot
On Tue, Mar 30, 2021 at 09:36:59AM +0800, Qiheng Lin wrote:
> In case of error, the function pci_iomap() returns NULL pointer
> not ERR_PTR(). The IS_ERR() test in the return value check
> should be replaced with NULL test.
Error path there is broken completely, this is only one place you fix, but I
suggest to switch to devm*, pcim* APIs instead,
--
With Best Regards,
Andy Shevchenko
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2021-03-30 9:28 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-03-30 1:36 [PATCH -next] misc/pvpanic: fix return value check in pvpanic_pci_probe() Qiheng Lin
2021-03-30 9:27 ` Andy Shevchenko
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox