misc/pvpanic: fix return value check in pvpanic_pci_probe()
authorQiheng Lin <linqiheng@huawei.com>
Tue, 30 Mar 2021 01:36:59 +0000 (09:36 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 2 Apr 2021 14:16:46 +0000 (16:16 +0200)
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>
Link: https://lore.kernel.org/r/20210330013659.916-1-linqiheng@huawei.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/misc/pvpanic/pvpanic-pci.c

index f38a80a5bbc8c63fb3b5510d42e4631d5894ba77..9ecc4e8559d5d266e7bd35643c021c4bb97457f6 100644 (file)
@@ -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)