05.09.2020 13:34, Mikko Perttunen пишет: > +int tegra_drm_ioctl_channel_open(struct drm_device *drm, void *data, > + struct drm_file *file) > +{ > + struct tegra_drm_file *fpriv = file->driver_priv; > + struct tegra_drm *tegra = drm->dev_private; > + struct drm_tegra_channel_open *args = data; > + struct tegra_drm_client *client = NULL; > + struct tegra_drm_channel_ctx *ctx; > + int err; > + > + if (args->flags || args->reserved[0] || args->reserved[1]) > + return -EINVAL; > + > + ctx = kzalloc(sizeof(*ctx), GFP_KERNEL); > + if (!ctx) > + return -ENOMEM; > + > + err = -ENODEV; > + list_for_each_entry(client, &tegra->clients, list) { > + if (client->base.class == args->host1x_class) { > + err = 0; > + break; > + } > + } > + if (err) > + goto free_ctx; > + > + if (client->shared_channel) { > + ctx->channel = host1x_channel_get(client->shared_channel); > + } else { > + ctx->channel = host1x_channel_request(&client->base); > + if (!ctx->channel) { > + err = -EBUSY; > + goto free_ctx; > + } > + } > + > + err = xa_alloc(&fpriv->contexts, &args->channel_ctx, ctx, > + XA_LIMIT(1, U32_MAX), GFP_KERNEL); > + if (err < 0) { > + mutex_unlock(&fpriv->lock); Looks like the lock was never taken. > + goto put_channel; > + } > + > + ctx->client = client; > + xa_init_flags(&ctx->mappings, XA_FLAGS_ALLOC); Why not XA_FLAGS_ALLOC1?