diff options
author | Anson Jacob <Anson.Jacob@amd.com> | 2021-08-23 20:41:13 +0300 |
---|---|---|
committer | Alex Deucher <alexander.deucher@amd.com> | 2021-09-14 22:57:10 +0300 |
commit | 7b89bf83181363a84f86da787159ddbbef505b8c (patch) | |
tree | 60033bd32f7d5f5512e18247371b5c4e557ab7b4 /drivers/gpu/drm/amd/display/dc/dcn302 | |
parent | f22268ce0a3f4065cddfb62ac29845b2c07c1c5a (diff) | |
download | linux-7b89bf83181363a84f86da787159ddbbef505b8c.tar.xz |
drm/amd/display: Fix multiple memory leaks reported by coverity
coccinelle patch used:
@@ expression enc1,vpg,afmt; @@
- if (!enc1 || !vpg || !afmt)
+ if (!enc1 || !vpg || !afmt) {
+ kfree(enc1);
+ kfree(vpg);
+ kfree(afmt);
return NULL;
+ }
Addresses-Coverity-ID: 1466017: ("Resource leaks")
Reviewed-by: Aurabindo Jayamohanan Pillai <Aurabindo.Pillai@amd.com>
Acked-by: Mikita Lipski <mikita.lipski@amd.com>
Signed-off-by: Anson Jacob <Anson.Jacob@amd.com>
Tested-by: Daniel Wheeler <daniel.wheeler@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Diffstat (limited to 'drivers/gpu/drm/amd/display/dc/dcn302')
-rw-r--r-- | drivers/gpu/drm/amd/display/dc/dcn302/dcn302_resource.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/drivers/gpu/drm/amd/display/dc/dcn302/dcn302_resource.c b/drivers/gpu/drm/amd/display/dc/dcn302/dcn302_resource.c index 5cd55e8573f7..fcf96cf08c76 100644 --- a/drivers/gpu/drm/amd/display/dc/dcn302/dcn302_resource.c +++ b/drivers/gpu/drm/amd/display/dc/dcn302/dcn302_resource.c @@ -542,8 +542,12 @@ static struct stream_encoder *dcn302_stream_encoder_create(enum engine_id eng_id vpg = dcn302_vpg_create(ctx, vpg_inst); afmt = dcn302_afmt_create(ctx, afmt_inst); - if (!enc1 || !vpg || !afmt) + if (!enc1 || !vpg || !afmt) { + kfree(enc1); + kfree(vpg); + kfree(afmt); return NULL; + } dcn30_dio_stream_encoder_construct(enc1, ctx, ctx->dc_bios, eng_id, vpg, afmt, &stream_enc_regs[eng_id], &se_shift, &se_mask); |