Message ID | 20211008074417.8260-1-yuehaibing@huawei.com (mailing list archive) |
---|---|
State | Accepted |
Commit | 32c932b6aef9fb2d68d3fafa5a12d18d460fd45d |
Headers | show |
Series | [-next] xen-pciback: Fix return in pm_ctrl_init() | expand |
On 08.10.21 09:44, YueHaibing wrote: > 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> Juergen
On 10/8/21 11:01 AM, Juergen Gross wrote: > On 08.10.21 09:44, YueHaibing wrote: >> 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> > Applied to for-linux-5.16. -boris
diff --git a/drivers/xen/xen-pciback/conf_space_capability.c b/drivers/xen/xen-pciback/conf_space_capability.c index 22f13abbe913..5e53b4817f16 100644 --- a/drivers/xen/xen-pciback/conf_space_capability.c +++ b/drivers/xen/xen-pciback/conf_space_capability.c @@ -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[] = {
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> --- drivers/xen/xen-pciback/conf_space_capability.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)