Thanks for sending this fix Xiaohui.

The upstream patch is more complete
https://github.com/torvalds/linux/commit/7b89bf83181363a84f86da787159ddbbef505b8c

I believe the fixes will arrive via a normal update process unless
somebody knows a reason to apply this one specifically out of schedule.

Xiaohui Zhang <[email protected]> writes:

> Free memory allocated if any of the previous allocations failed.
>
> Signed-off-by: Xiaohui Zhang <[email protected]>
> ---
>  sys/dev/pci/drm/amd/display/dc/dcn302/dcn302_resource.c | 6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)
>
> diff --git a/sys/dev/pci/drm/amd/display/dc/dcn302/dcn302_resource.c 
> b/sys/dev/pci/drm/amd/display/dc/dcn302/dcn302_resource.c
> index 2292bb820..7f04042d2 100644
> --- a/sys/dev/pci/drm/amd/display/dc/dcn302/dcn302_resource.c
> +++ b/sys/dev/pci/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);

Reply via email to