xen-pciback: Fix return in pm_ctrl_init()
authorYueHaibing <yuehaibing@huawei.com>
Fri, 8 Oct 2021 07:44:17 +0000 (15:44 +0800)
committerBoris Ostrovsky <boris.ostrovsky@oracle.com>
Tue, 2 Nov 2021 12:45:44 +0000 (07:45 -0500)
Return NULL instead of passing to ERR_PTR while err is zero,
this fix smatch warnings:
drivers/xen/xen-pciback/conf_space_capability.c:163
 pm_ctrl_init() warn: passing zero to 'ERR_PTR'

Fixes: a92336a1176b ("xen/pciback: Drop two backends, squash and cleanup some code.")
Signed-off-by: YueHaibing <yuehaibing@huawei.com>
Reviewed-by: Juergen Gross <jgross@suse.com>
Link: https://lore.kernel.org/r/20211008074417.8260-1-yuehaibing@huawei.com
Signed-off-by: Boris Ostrovsky <boris.ostrovsky@oracle.com>
drivers/xen/xen-pciback/conf_space_capability.c

index 22f13ab..5e53b48 100644 (file)
@@ -160,7 +160,7 @@ static void *pm_ctrl_init(struct pci_dev *dev, int offset)
        }
 
 out:
-       return ERR_PTR(err);
+       return err ? ERR_PTR(err) : NULL;
 }
 
 static const struct config_field caplist_pm[] = {