Skip to contentSkip to conversation

xen-pciback: Fix return in pm_ctrl_init()

PATCH Applied YueHaibing 3 participants 3 messages Oct 8, 2021 – Oct 27, 2021 Xen hypervisor interface

lore
Share & tools
lore

YueHaibing

author
#0 lore raw

PATCH 1/1 xen-pciback: Fix return in pm_ctrl_init()

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.")
---
 drivers/xen/xen-pciback/conf_space_capability.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/xen/xen-pciback/conf_space_capability.c +1 -1
index 22f13abbe913..5e53b4817f16 100644
@@ -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[] = {
Signature · 1 line
2.17.1
maintainer Reviewed-by on v1 1/1
#1 lore raw
Quoted 7 lines · YueHaibing

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.")

Juergen

#2 lore raw
Quoted 11 lines · Juergen Gross
Quoted 7 lines · YueHaibing

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.")

Applied to for-linux-5.16.

-boris