> When amdgpu_display_modeset_create_props() fails, state and > state->context should be freed to prevent memleak. It's the > same when amdgpu_dm_audio_init() fails. * Can another imperative wording become helpful for the change description? * Would you like to consider the tag “Fixes” for the commit message? https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/commit/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c?id=08572451b4b1783fdff787b0188c4d50fdf96b81 … > +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c > @@ -2834,12 +2834,18 @@ static int amdgpu_dm_mode_config_init(struct amdgpu_device *adev) > &dm_atomic_state_funcs); > > r = amdgpu_display_modeset_create_props(adev); > - if (r) > + if (r) { > + dc_release_state(state->context); > + kfree(state); > return r; > + } > > r = amdgpu_dm_audio_init(adev); > - if (r) > + if (r) { > + dc_release_state(state->context); > + kfree(state); > return r; > + } > > return 0; > } I imagine that the exception handling code can be improved another bit for this function implementation. How do you think about to avoid such duplicate source code? https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/process/coding-style.rst?id=15bc20c6af4ceee97a1f90b43c0e386643c071b4#n475 Regards, Markus _______________________________________________ dri-devel mailing list dri-devel@xxxxxxxxxxxxxxxxxxxxx https://lists.freedesktop.org/mailman/listinfo/dri-devel