[PATCH] fix drm-get-put.cocci warnings

From: Julia Lawall
Date: Mon Jan 15 2018 - 08:26:27 EST


From: Fengguang Wu <fengguang.wu@xxxxxxxxx>

Use drm_*_get() and drm_*_put() helpers instead of drm_*_reference() and
drm_*_unreference() helpers.

Generated by: scripts/coccinelle/api/drm-get-put.cocci

Signed-off-by: Fengguang Wu <fengguang.wu@xxxxxxxxx>
Signed-off-by: Julia Lawall <julia.lawall@xxxxxxx>
---

tree: https://github.com/thierryreding/linux for-4.16/work
head: 6c86494bb2f670293f6137b0a4b3c53c8886eba4
commit: 34f022b2d11f91a323d3e7d15893d480646f3fad [149/161] WIP

nouveau_gem.c | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)

--- a/drivers/gpu/drm/nouveau/nouveau_gem.c
+++ b/drivers/gpu/drm/nouveau/nouveau_gem.c
@@ -296,7 +296,7 @@ nouveau_gem_ioctl_new(struct drm_device
}

/* drop reference from allocate - handle holds it now */
- drm_gem_object_unreference_unlocked(&nvbo->gem);
+ drm_gem_object_put_unlocked(&nvbo->gem);
return ret;
}

@@ -365,7 +365,7 @@ validate_fini_no_ticket(struct validate_
list_del(&nvbo->entry);
nvbo->reserved_by = NULL;
ttm_bo_unreserve(&nvbo->bo);
- drm_gem_object_unreference_unlocked(&nvbo->gem);
+ drm_gem_object_put_unlocked(&nvbo->gem);
}
}

@@ -411,14 +411,14 @@ retry:
nvbo = nouveau_gem_object(gem);
if (nvbo == res_bo) {
res_bo = NULL;
- drm_gem_object_unreference_unlocked(gem);
+ drm_gem_object_put_unlocked(gem);
continue;
}

if (nvbo->reserved_by && nvbo->reserved_by == file_priv) {
NV_PRINTK(err, cli, "multiple instances of buffer %d on "
"validation list\n", b->handle);
- drm_gem_object_unreference_unlocked(gem);
+ drm_gem_object_put_unlocked(gem);
ret = -EINVAL;
break;
}
@@ -969,7 +969,7 @@ nouveau_gem_ioctl_cpu_prep(struct drm_de
ret = lret;

nouveau_bo_sync_for_cpu(nvbo);
- drm_gem_object_unreference_unlocked(gem);
+ drm_gem_object_put_unlocked(gem);

return ret;
}
@@ -988,7 +988,7 @@ nouveau_gem_ioctl_cpu_fini(struct drm_de
nvbo = nouveau_gem_object(gem);

nouveau_bo_sync_for_device(nvbo);
- drm_gem_object_unreference_unlocked(gem);
+ drm_gem_object_put_unlocked(gem);
return 0;
}

@@ -1005,7 +1005,7 @@ nouveau_gem_ioctl_info(struct drm_device
return -ENOENT;

ret = nouveau_gem_info(file_priv, gem, req);
- drm_gem_object_unreference_unlocked(gem);
+ drm_gem_object_put_unlocked(gem);
return ret;
}

@@ -1153,7 +1153,7 @@ out:
return err;

unref:
- drm_gem_object_unreference(&nvbo->gem);
+ drm_gem_object_put(&nvbo->gem);
unref_bo:
nouveau_bo_ref(NULL, &nvbo);
free_sgt: