diff options
Diffstat (limited to 'drivers/gpu/nvgpu/gk20a/tsg_gk20a.c')
-rw-r--r-- | drivers/gpu/nvgpu/gk20a/tsg_gk20a.c | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/drivers/gpu/nvgpu/gk20a/tsg_gk20a.c b/drivers/gpu/nvgpu/gk20a/tsg_gk20a.c index 270fed85..21b50700 100644 --- a/drivers/gpu/nvgpu/gk20a/tsg_gk20a.c +++ b/drivers/gpu/nvgpu/gk20a/tsg_gk20a.c | |||
@@ -22,6 +22,8 @@ | |||
22 | #include <uapi/linux/nvgpu.h> | 22 | #include <uapi/linux/nvgpu.h> |
23 | #include <linux/anon_inodes.h> | 23 | #include <linux/anon_inodes.h> |
24 | 24 | ||
25 | #include <nvgpu/kmem.h> | ||
26 | |||
25 | #include "gk20a.h" | 27 | #include "gk20a.h" |
26 | 28 | ||
27 | #include <nvgpu/hw/gk20a/hw_ccsr_gk20a.h> | 29 | #include <nvgpu/hw/gk20a/hw_ccsr_gk20a.h> |
@@ -257,7 +259,7 @@ static int gk20a_tsg_event_id_enable(struct tsg_gk20a *tsg, | |||
257 | int err = 0; | 259 | int err = 0; |
258 | int local_fd; | 260 | int local_fd; |
259 | struct file *file; | 261 | struct file *file; |
260 | char *name; | 262 | char name[64]; |
261 | struct gk20a_event_id_data *event_id_data; | 263 | struct gk20a_event_id_data *event_id_data; |
262 | struct gk20a *g; | 264 | struct gk20a *g; |
263 | 265 | ||
@@ -278,18 +280,17 @@ static int gk20a_tsg_event_id_enable(struct tsg_gk20a *tsg, | |||
278 | goto free_ref; | 280 | goto free_ref; |
279 | local_fd = err; | 281 | local_fd = err; |
280 | 282 | ||
281 | name = kasprintf(GFP_KERNEL, "nvgpu-event%d-fd%d", | 283 | snprintf(name, sizeof(name), "nvgpu-event%d-fd%d", |
282 | event_id, local_fd); | 284 | event_id, local_fd); |
283 | 285 | ||
284 | file = anon_inode_getfile(name, &gk20a_event_id_ops, | 286 | file = anon_inode_getfile(name, &gk20a_event_id_ops, |
285 | NULL, O_RDWR); | 287 | NULL, O_RDWR); |
286 | kfree(name); | ||
287 | if (IS_ERR(file)) { | 288 | if (IS_ERR(file)) { |
288 | err = PTR_ERR(file); | 289 | err = PTR_ERR(file); |
289 | goto clean_up; | 290 | goto clean_up; |
290 | } | 291 | } |
291 | 292 | ||
292 | event_id_data = kzalloc(sizeof(*event_id_data), GFP_KERNEL); | 293 | event_id_data = nvgpu_kzalloc(tsg->g, sizeof(*event_id_data)); |
293 | if (!event_id_data) { | 294 | if (!event_id_data) { |
294 | err = -ENOMEM; | 295 | err = -ENOMEM; |
295 | goto clean_up_file; | 296 | goto clean_up_file; |
@@ -428,7 +429,7 @@ int gk20a_tsg_open(struct gk20a *g, struct file *filp) | |||
428 | 429 | ||
429 | gk20a_dbg(gpu_dbg_fn, "tsg: %s", dev_name(dev)); | 430 | gk20a_dbg(gpu_dbg_fn, "tsg: %s", dev_name(dev)); |
430 | 431 | ||
431 | priv = kmalloc(sizeof(*priv), GFP_KERNEL); | 432 | priv = nvgpu_kmalloc(g, sizeof(*priv)); |
432 | if (!priv) { | 433 | if (!priv) { |
433 | err = -ENOMEM; | 434 | err = -ENOMEM; |
434 | goto free_ref; | 435 | goto free_ref; |
@@ -436,7 +437,7 @@ int gk20a_tsg_open(struct gk20a *g, struct file *filp) | |||
436 | 437 | ||
437 | tsg = acquire_unused_tsg(&g->fifo); | 438 | tsg = acquire_unused_tsg(&g->fifo); |
438 | if (!tsg) { | 439 | if (!tsg) { |
439 | kfree(priv); | 440 | nvgpu_kfree(g, priv); |
440 | err = -ENOMEM; | 441 | err = -ENOMEM; |
441 | goto free_ref; | 442 | goto free_ref; |
442 | } | 443 | } |
@@ -533,7 +534,7 @@ int gk20a_tsg_dev_release(struct inode *inode, struct file *filp) | |||
533 | struct tsg_gk20a *tsg = priv->tsg; | 534 | struct tsg_gk20a *tsg = priv->tsg; |
534 | 535 | ||
535 | kref_put(&tsg->refcount, gk20a_tsg_release); | 536 | kref_put(&tsg->refcount, gk20a_tsg_release); |
536 | kfree(priv); | 537 | nvgpu_kfree(tsg->g, priv); |
537 | return 0; | 538 | return 0; |
538 | } | 539 | } |
539 | 540 | ||