gpu: nvgpu: do nothing on invalid tsg release

If nvgpu_ioctl_tsg_open() fails, this file has no priv data yet on
release(). In that case there is nothing to free so just return.

Jira NVGPU-967

Change-Id: I02dd1bb12a27745a3b28aaa4a943d79d82b14d2c
Signed-off-by: Konsta Holtta <kholtta@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1847592
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
This commit is contained in:
Konsta Holtta
2018-09-26 15:34:42 +03:00
committed by Abdul Salam
parent fe76480e58
commit 8b9dcceb9a

View File

@@ -467,7 +467,14 @@ void nvgpu_ioctl_tsg_release(struct nvgpu_ref *ref)
int nvgpu_ioctl_tsg_dev_release(struct inode *inode, struct file *filp)
{
struct tsg_private *priv = filp->private_data;
struct tsg_gk20a *tsg = priv->tsg;
struct tsg_gk20a *tsg;
if (!priv) {
/* open failed, never got a tsg for this file */
return 0;
}
tsg = priv->tsg;
nvgpu_ref_put(&tsg->refcount, nvgpu_ioctl_tsg_release);
nvgpu_kfree(tsg->g, priv);