diff mbox series

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

Message ID 20190222063404.GA12190@kadam (mailing list archive)
State New, archived
Headers show
Series drm/nouveau/dmem: Fix a NULL vs IS_ERR() check | expand

Commit Message

Dan Carpenter Feb. 22, 2019, 6:34 a.m. UTC
The hmm_devmem_add() function doesn't return NULL, it returns error
pointers.

Fixes: 5be73b690875 ("drm/nouveau/dmem: device memory helpers for SVM")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
 drivers/gpu/drm/nouveau/nouveau_dmem.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Ben Skeggs Feb. 26, 2019, 1:38 a.m. UTC | #1
Got it, thanks!

On Fri, Feb 22, 2019 at 4:34 PM Dan Carpenter <dan.carpenter@oracle.com> wrote:
>
> The hmm_devmem_add() function doesn't return NULL, it returns error
> pointers.
>
> Fixes: 5be73b690875 ("drm/nouveau/dmem: device memory helpers for SVM")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> ---
>  drivers/gpu/drm/nouveau/nouveau_dmem.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/nouveau/nouveau_dmem.c b/drivers/gpu/drm/nouveau/nouveau_dmem.c
> index aa9fec80492d..28624dd0c920 100644
> --- a/drivers/gpu/drm/nouveau/nouveau_dmem.c
> +++ b/drivers/gpu/drm/nouveau/nouveau_dmem.c
> @@ -623,7 +623,7 @@ nouveau_dmem_init(struct nouveau_drm *drm)
>          */
>         drm->dmem->devmem = hmm_devmem_add(&nouveau_dmem_devmem_ops,
>                                            device, size);
> -       if (drm->dmem->devmem == NULL) {
> +       if (IS_ERR(drm->dmem->devmem)) {
>                 kfree(drm->dmem);
>                 drm->dmem = NULL;
>                 return;
> --
> 2.17.1
>
diff mbox series

Patch

diff --git a/drivers/gpu/drm/nouveau/nouveau_dmem.c b/drivers/gpu/drm/nouveau/nouveau_dmem.c
index aa9fec80492d..28624dd0c920 100644
--- a/drivers/gpu/drm/nouveau/nouveau_dmem.c
+++ b/drivers/gpu/drm/nouveau/nouveau_dmem.c
@@ -623,7 +623,7 @@  nouveau_dmem_init(struct nouveau_drm *drm)
 	 */
 	drm->dmem->devmem = hmm_devmem_add(&nouveau_dmem_devmem_ops,
 					   device, size);
-	if (drm->dmem->devmem == NULL) {
+	if (IS_ERR(drm->dmem->devmem)) {
 		kfree(drm->dmem);
 		drm->dmem = NULL;
 		return;