2
0
mirror of https://github.com/edk2-porting/linux-next.git synced 2024-12-20 19:23:57 +08:00

cxl: Fix error handling in _cxl_pci_associate_default_context()

'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>
This commit is contained in:
Christophe Jaillet 2016-10-30 22:40:47 +01:00 committed by Michael Ellerman
parent 28e323e5a0
commit bb81733de2
2 changed files with 2 additions and 2 deletions

View 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;

View 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;