aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/radeon/atom.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/gpu/drm/radeon/atom.c')
-rw-r--r--drivers/gpu/drm/radeon/atom.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/drivers/gpu/drm/radeon/atom.c b/drivers/gpu/drm/radeon/atom.c
index 5ce9bf51a8de..46a9c3772850 100644
--- a/drivers/gpu/drm/radeon/atom.c
+++ b/drivers/gpu/drm/radeon/atom.c
@@ -1238,6 +1238,8 @@ static int atom_iio_len[] = { 1, 2, 3, 3, 3, 3, 4, 4, 4, 3 };
1238static void atom_index_iio(struct atom_context *ctx, int base) 1238static void atom_index_iio(struct atom_context *ctx, int base)
1239{ 1239{
1240 ctx->iio = kzalloc(2 * 256, GFP_KERNEL); 1240 ctx->iio = kzalloc(2 * 256, GFP_KERNEL);
1241 if (!ctx->iio)
1242 return;
1241 while (CU8(base) == ATOM_IIO_START) { 1243 while (CU8(base) == ATOM_IIO_START) {
1242 ctx->iio[CU8(base + 1)] = base + 2; 1244 ctx->iio[CU8(base + 1)] = base + 2;
1243 base += 2; 1245 base += 2;
@@ -1287,6 +1289,10 @@ struct atom_context *atom_parse(struct card_info *card, void *bios)
1287 ctx->cmd_table = CU16(base + ATOM_ROM_CMD_PTR); 1289 ctx->cmd_table = CU16(base + ATOM_ROM_CMD_PTR);
1288 ctx->data_table = CU16(base + ATOM_ROM_DATA_PTR); 1290 ctx->data_table = CU16(base + ATOM_ROM_DATA_PTR);
1289 atom_index_iio(ctx, CU16(ctx->data_table + ATOM_DATA_IIO_PTR) + 4); 1291 atom_index_iio(ctx, CU16(ctx->data_table + ATOM_DATA_IIO_PTR) + 4);
1292 if (!ctx->iio) {
1293 atom_destroy(ctx);
1294 return NULL;
1295 }
1290 1296
1291 str = CSTR(CU16(base + ATOM_ROM_MSG_PTR)); 1297 str = CSTR(CU16(base + ATOM_ROM_MSG_PTR));
1292 while (*str && ((*str == '\n') || (*str == '\r'))) 1298 while (*str && ((*str == '\n') || (*str == '\r')))
@@ -1335,8 +1341,7 @@ int atom_asic_init(struct atom_context *ctx)
1335 1341
1336void atom_destroy(struct atom_context *ctx) 1342void atom_destroy(struct atom_context *ctx)
1337{ 1343{
1338 if (ctx->iio) 1344 kfree(ctx->iio);
1339 kfree(ctx->iio);
1340 kfree(ctx); 1345 kfree(ctx);
1341} 1346}
1342 1347