gpu: nvgpu: check for null priv in channel_release

gk20a_channel_release can still get called even if the open_channel call failed
(e.g., if we ran out of hw chids), in which case priv is null. Check for this
case and return if null.

Bug 1964531

Change-Id: I48bc88e4dbd88a1c30fc399de629d8f8b344cfd9
Signed-off-by: Peter Daifuku <pdaifuku@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1526544
Reviewed-by: Automatic_Commit_Validation_User
GVS: Gerrit_Virtual_Submit
Reviewed-by: Alex Waterman <alexw@nvidia.com>
Reviewed-by: Vijayakumar Subbu <vsubbu@nvidia.com>
This commit is contained in:
Peter Daifuku
2017-07-25 15:20:49 -07:00
committed by mobile promotions
parent 542a75a949
commit 1b5035132b

View File

@@ -281,11 +281,20 @@ struct channel_gk20a *gk20a_get_channel_from_file(int fd)
int gk20a_channel_release(struct inode *inode, struct file *filp)
{
struct channel_priv *priv = filp->private_data;
struct channel_gk20a *ch = priv->c;
struct gk20a *g = priv->g;
struct channel_gk20a *ch;
struct gk20a *g;
int err;
/* We could still end up here even if the channel_open failed, e.g.
* if we ran out of hw channel IDs.
*/
if (!priv)
return 0;
ch = priv->c;
g = priv->g;
err = gk20a_busy(g);
if (err) {
nvgpu_err(g, "failed to release a channel!");