cxl: Fix error handling in _cxl_pci_associate_default_context()
authorChristophe Jaillet <christophe.jaillet@wanadoo.fr>
Sun, 30 Oct 2016 21:40:47 +0000 (22:40 +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/pci.c
drivers/misc/cxl/phb.c

index e96be9ca4e60437db6bfba9b098fad852790f722..80a87ab25b83857a77ada244b6159c7b1c55a31a 100644 (file)
@@ -1921,7 +1921,7 @@ static pci_ers_result_t cxl_pci_slot_reset(struct pci_dev *pdev)
                                goto err;
 
                        ctx = cxl_dev_context_init(afu_dev);
-                       if (!ctx)
+                       if (IS_ERR(ctx))
                                goto err;
 
                        afu_dev->dev.archdata.cxl_ctx = ctx;
index 0935d44c177097f76f309d7084d440123c7201b7..6ec69ada19f480ce62c1763e8b473a923f87951b 100644 (file)
@@ -20,7 +20,7 @@ bool _cxl_pci_associate_default_context(struct pci_dev *dev, struct cxl_afu *afu
         * in the virtual phb, we'll need a default context to attach them to.
         */
        ctx = cxl_dev_context_init(dev);
-       if (!ctx)
+       if (IS_ERR(ctx))
                return false;
        dev->dev.archdata.cxl_ctx = ctx;