summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/nvgpu/common/linux/ioctl_channel.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/gpu/nvgpu/common/linux/ioctl_channel.c')
-rw-r--r--drivers/gpu/nvgpu/common/linux/ioctl_channel.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/drivers/gpu/nvgpu/common/linux/ioctl_channel.c b/drivers/gpu/nvgpu/common/linux/ioctl_channel.c
index 2242e19e..ab02dc42 100644
--- a/drivers/gpu/nvgpu/common/linux/ioctl_channel.c
+++ b/drivers/gpu/nvgpu/common/linux/ioctl_channel.c
@@ -281,11 +281,20 @@ struct channel_gk20a *gk20a_get_channel_from_file(int fd)
281int gk20a_channel_release(struct inode *inode, struct file *filp) 281int gk20a_channel_release(struct inode *inode, struct file *filp)
282{ 282{
283 struct channel_priv *priv = filp->private_data; 283 struct channel_priv *priv = filp->private_data;
284 struct channel_gk20a *ch = priv->c; 284 struct channel_gk20a *ch;
285 struct gk20a *g = priv->g; 285 struct gk20a *g;
286 286
287 int err; 287 int err;
288 288
289 /* We could still end up here even if the channel_open failed, e.g.
290 * if we ran out of hw channel IDs.
291 */
292 if (!priv)
293 return 0;
294
295 ch = priv->c;
296 g = priv->g;
297
289 err = gk20a_busy(g); 298 err = gk20a_busy(g);
290 if (err) { 299 if (err) {
291 nvgpu_err(g, "failed to release a channel!"); 300 nvgpu_err(g, "failed to release a channel!");