Commit 18ec3c12 authored by Dan Carpenter's avatar Dan Carpenter Committed by Ben Skeggs

drm/nouveau/dmem: Fix a NULL vs IS_ERR() check

The hmm_devmem_add() function doesn't return NULL, it returns error
pointers.

Fixes: 5be73b69 ("drm/nouveau/dmem: device memory helpers for SVM")
Signed-off-by: default avatarDan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: default avatarBen Skeggs <bskeggs@redhat.com>
parent 2219c9ee
...@@ -621,7 +621,7 @@ nouveau_dmem_init(struct nouveau_drm *drm) ...@@ -621,7 +621,7 @@ nouveau_dmem_init(struct nouveau_drm *drm)
*/ */
drm->dmem->devmem = hmm_devmem_add(&nouveau_dmem_devmem_ops, drm->dmem->devmem = hmm_devmem_add(&nouveau_dmem_devmem_ops,
device, size); device, size);
if (drm->dmem->devmem == NULL) { if (IS_ERR(drm->dmem->devmem)) {
kfree(drm->dmem); kfree(drm->dmem);
drm->dmem = NULL; drm->dmem = NULL;
return; return;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment