if (!nv_wait(dev, 0x409800, 0x80000000, 0x80000000)) {
NV_ERROR(dev, "PGRAPH: HUB_SET_CHAN timeout\n");
nvc0_graph_ctxctl_debug(dev);
- return -EBUSY;
+ ret = -EBUSY;
+ goto err;
}
} else {
nvc0_graph_load_context(chan);
}
ret = nvc0_grctx_generate(chan);
- if (ret) {
- kfree(ctx);
- return ret;
- }
+ if (ret)
+ goto err;
if (!nouveau_ctxfw) {
nv_wr32(dev, 0x409840, 0x80000000);
if (!nv_wait(dev, 0x409800, 0x80000000, 0x80000000)) {
NV_ERROR(dev, "PGRAPH: HUB_CTX_SAVE timeout\n");
nvc0_graph_ctxctl_debug(dev);
- return -EBUSY;
+ ret = -EBUSY;
+ goto err;
}
} else {
ret = nvc0_graph_unload_context_to(dev, chan->ramin->vinst);
- if (ret) {
- kfree(ctx);
- return ret;
- }
+ if (ret)
+ goto err;
}
for (i = 0; i < priv->grctx_size; i += 4)
priv->grctx_vals = ctx;
return 0;
+
+err:
+ kfree(ctx);
+ return ret;
}
static int