diff options
author | Thierry Reding <treding@nvidia.com> | 2013-11-08 13:25:52 +0100 |
---|---|---|
committer | Thierry Reding <treding@nvidia.com> | 2014-08-07 16:05:08 +0200 |
commit | d5dac3b9ae4c6743379050718451a770e6c8a6ab (patch) | |
tree | b044407615f850aa0170cf59317812d2b8257b49 | |
parent | 9579e67968298ca8e9841688ae3dd8c6e27947b8 (diff) |
WIP: gpu: host1x: Replace a variable length arraystaging/host1x
Explicitly allocate the array with the correct length instead of using a
variable length array. The variable length array is probably safe in
this case, but sparse complains about it.
Signed-off-by: Thierry Reding <treding@nvidia.com>
-rw-r--r-- | drivers/gpu/host1x/job.c | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/drivers/gpu/host1x/job.c b/drivers/gpu/host1x/job.c index 63bd63f3c7df..e115bf22e5d8 100644 --- a/drivers/gpu/host1x/job.c +++ b/drivers/gpu/host1x/job.c @@ -507,12 +507,16 @@ static inline int copy_gathers(struct host1x_job *job, struct device *dev) int host1x_job_pin(struct host1x_job *job, struct device *dev) { - int err; - unsigned int i, j; struct host1x *host = dev_get_drvdata(dev->parent); - DECLARE_BITMAP(waitchk_mask, host1x_syncpt_nb_pts(host)); + unsigned int num = host1x_syncpt_nb_pts(host); + unsigned long *waitchk_mask; + unsigned int i, j; + int err; + + waitchk_mask = kcalloc(sizeof(*waitchk_mask), num, GFP_KERNEL); + if (!waitchk_mask) + return -ENOMEM; - bitmap_zero(waitchk_mask, host1x_syncpt_nb_pts(host)); for (i = 0; i < job->num_waitchk; i++) { u32 syncpt_id = job->waitchk[i].syncpt_id; if (syncpt_id < host1x_syncpt_nb_pts(host)) @@ -523,6 +527,8 @@ int host1x_job_pin(struct host1x_job *job, struct device *dev) for_each_set_bit(i, waitchk_mask, host1x_syncpt_nb_pts(host)) host1x_syncpt_load(host->syncpt + i); + kfree(waitchk_mask); + /* pin memory */ err = pin_job(job); if (!err) |