mirror of
git://nv-tegra.nvidia.com/linux-nvgpu.git
synced 2025-12-25 11:04:51 +03:00
gpu: nvgpu: handle syncpoint buffer alloc failure
Add check for syncpoint buffer allocation failure in the function nvgpu_channel_sync_syncpt_create. Return NULL if the allocation fails. Also, put a reference to the syncpoint allocated if the above buffer allocation fails. Change-Id: I56ab03df3b37a3c8148ee17ec6a7829686e44de6 Signed-off-by: Debarshi Dutta <ddutta@nvidia.com> Reviewed-on: https://git-master.nvidia.com/r/2247637 Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com> Reviewed-by: svc-mobile-misra <svc-mobile-misra@nvidia.com> Reviewed-by: svc-mobile-cert <svc-mobile-cert@nvidia.com> Reviewed-by: Automatic_Commit_Validation_User GVS: Gerrit_Virtual_Submit Reviewed-by: Vijayakumar Subbu <vsubbu@nvidia.com> Reviewed-by: Deepak Nibade <dnibade@nvidia.com> Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com> Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
This commit is contained in:
committed by
Alex Waterman
parent
8592b0591c
commit
037c5761e7
@@ -365,6 +365,7 @@ nvgpu_channel_sync_syncpt_create(struct nvgpu_channel *c, bool user_managed)
|
||||
{
|
||||
struct nvgpu_channel_sync_syncpt *sp;
|
||||
char syncpt_name[32];
|
||||
int err;
|
||||
|
||||
sp = nvgpu_kzalloc(c->g, sizeof(*sp));
|
||||
if (sp == NULL) {
|
||||
@@ -396,9 +397,16 @@ nvgpu_channel_sync_syncpt_create(struct nvgpu_channel *c, bool user_managed)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
sp->c->g->ops.sync.syncpt.alloc_buf(sp->c, sp->id,
|
||||
err = sp->c->g->ops.sync.syncpt.alloc_buf(sp->c, sp->id,
|
||||
&sp->syncpt_buf);
|
||||
|
||||
if (err != 0) {
|
||||
nvgpu_nvhost_syncpt_put_ref_ext(sp->nvhost_dev, sp->id);
|
||||
nvgpu_kfree(c->g, sp);
|
||||
nvgpu_err(c->g, "failed to allocate syncpoint buffer");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
nvgpu_nvhost_syncpt_set_min_eq_max_ext(sp->nvhost_dev, sp->id);
|
||||
|
||||
nvgpu_atomic_set(&sp->ops.refcount, 0);
|
||||
|
||||
Reference in New Issue
Block a user