cxl: Fix error handling in _cxl_cx4_setup_msi_irqs()
authorChristophe Jaillet <christophe.jaillet@wanadoo.fr>
Sun, 30 Oct 2016 21:34:51 +0000 (22:34 +0100)
committerMichael Ellerman <mpe@ellerman.id.au>
Fri, 18 Nov 2016 11:41:08 +0000 (22:41 +1100)
'cxl_dev_context_init()' returns an error pointer in case of error, not
NULL. So test it with IS_ERR.

Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Reviewed-by: Andrew Donnellan <andrew.donnellan@au1.ibm.com>
Acked-by: Frederic Barrat <fbarrat@linux.vnet.ibm.com>
Acked-by: Ian Munsie <imunsie@au1.ibm.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
drivers/misc/cxl/api.c

index 2b88ad8a2a89ecb676e78b28c64c6802bd5354a9..e2efc6489c6e1508fedc32b4716d53604b1bc2f8 100644 (file)
@@ -538,7 +538,7 @@ int _cxl_cx4_setup_msi_irqs(struct pci_dev *pdev, int nvec, int type)
 
                if (remaining > 0) {
                        new_ctx = cxl_dev_context_init(pdev);
-                       if (!new_ctx) {
+                       if (IS_ERR(new_ctx)) {
                                pr_warn("%s: Failed to allocate enough contexts for MSIs\n", pci_name(pdev));
                                return -ENOSPC;
                        }