Dan Carpenter
2019-Feb-22 06:34 UTC
[Nouveau] [PATCH] drm/nouveau/dmem: Fix a NULL vs IS_ERR() check
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 at 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
Ben Skeggs
2019-Feb-26 01:38 UTC
[Nouveau] [PATCH] drm/nouveau/dmem: Fix a NULL vs IS_ERR() check
Got it, thanks! On Fri, Feb 22, 2019 at 4:34 PM Dan Carpenter <dan.carpenter at 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 at 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 >