diff options
| -rw-r--r-- | drivers/gpu/drm/nouveau/nv40_graph.c | 8 | ||||
| -rw-r--r-- | drivers/gpu/drm/radeon/radeon_atombios.c | 13 |
2 files changed, 18 insertions, 3 deletions
diff --git a/drivers/gpu/drm/nouveau/nv40_graph.c b/drivers/gpu/drm/nouveau/nv40_graph.c index 0616c96e4b67..704a25d04ac9 100644 --- a/drivers/gpu/drm/nouveau/nv40_graph.c +++ b/drivers/gpu/drm/nouveau/nv40_graph.c | |||
| @@ -253,7 +253,11 @@ nv40_graph_init(struct drm_device *dev) | |||
| 253 | 253 | ||
| 254 | if (!dev_priv->engine.graph.ctxprog) { | 254 | if (!dev_priv->engine.graph.ctxprog) { |
| 255 | struct nouveau_grctx ctx = {}; | 255 | struct nouveau_grctx ctx = {}; |
| 256 | uint32_t cp[256]; | 256 | uint32_t *cp; |
| 257 | |||
| 258 | cp = kmalloc(sizeof(*cp) * 256, GFP_KERNEL); | ||
| 259 | if (!cp) | ||
| 260 | return -ENOMEM; | ||
| 257 | 261 | ||
| 258 | ctx.dev = dev; | 262 | ctx.dev = dev; |
| 259 | ctx.mode = NOUVEAU_GRCTX_PROG; | 263 | ctx.mode = NOUVEAU_GRCTX_PROG; |
| @@ -265,6 +269,8 @@ nv40_graph_init(struct drm_device *dev) | |||
| 265 | nv_wr32(dev, NV40_PGRAPH_CTXCTL_UCODE_INDEX, 0); | 269 | nv_wr32(dev, NV40_PGRAPH_CTXCTL_UCODE_INDEX, 0); |
| 266 | for (i = 0; i < ctx.ctxprog_len; i++) | 270 | for (i = 0; i < ctx.ctxprog_len; i++) |
| 267 | nv_wr32(dev, NV40_PGRAPH_CTXCTL_UCODE_DATA, cp[i]); | 271 | nv_wr32(dev, NV40_PGRAPH_CTXCTL_UCODE_DATA, cp[i]); |
| 272 | |||
| 273 | kfree(cp); | ||
| 268 | } | 274 | } |
| 269 | 275 | ||
| 270 | /* No context present currently */ | 276 | /* No context present currently */ |
diff --git a/drivers/gpu/drm/radeon/radeon_atombios.c b/drivers/gpu/drm/radeon/radeon_atombios.c index 6e733fdc3349..24ea683f7cf5 100644 --- a/drivers/gpu/drm/radeon/radeon_atombios.c +++ b/drivers/gpu/drm/radeon/radeon_atombios.c | |||
| @@ -680,10 +680,18 @@ bool radeon_get_atom_connector_info_from_supported_devices_table(struct | |||
| 680 | uint8_t dac; | 680 | uint8_t dac; |
| 681 | union atom_supported_devices *supported_devices; | 681 | union atom_supported_devices *supported_devices; |
| 682 | int i, j, max_device; | 682 | int i, j, max_device; |
| 683 | struct bios_connector bios_connectors[ATOM_MAX_SUPPORTED_DEVICE]; | 683 | struct bios_connector *bios_connectors; |
| 684 | size_t bc_size = sizeof(*bios_connectors) * ATOM_MAX_SUPPORTED_DEVICE; | ||
| 684 | 685 | ||
| 685 | if (!atom_parse_data_header(ctx, index, &size, &frev, &crev, &data_offset)) | 686 | bios_connectors = kzalloc(bc_size, GFP_KERNEL); |
| 687 | if (!bios_connectors) | ||
| 688 | return false; | ||
| 689 | |||
| 690 | if (!atom_parse_data_header(ctx, index, &size, &frev, &crev, | ||
| 691 | &data_offset)) { | ||
| 692 | kfree(bios_connectors); | ||
| 686 | return false; | 693 | return false; |
| 694 | } | ||
| 687 | 695 | ||
| 688 | supported_devices = | 696 | supported_devices = |
| 689 | (union atom_supported_devices *)(ctx->bios + data_offset); | 697 | (union atom_supported_devices *)(ctx->bios + data_offset); |
| @@ -851,6 +859,7 @@ bool radeon_get_atom_connector_info_from_supported_devices_table(struct | |||
| 851 | 859 | ||
| 852 | radeon_link_encoder_connector(dev); | 860 | radeon_link_encoder_connector(dev); |
| 853 | 861 | ||
| 862 | kfree(bios_connectors); | ||
| 854 | return true; | 863 | return true; |
| 855 | } | 864 | } |
| 856 | 865 | ||
