Skip to content

ASoC: hdac_hdmi: use devm_kzalloc for all structures - #491

Merged
plbossart merged 1 commit into
thesofproject:topic/sof-devfrom
plbossart:fix/hdac_hdmi_devm_kzalloc
Jan 25, 2019
Merged

plbossart merged 1 commit into
thesofproject:topic/sof-devfrom
plbossart:fix/hdac_hdmi_devm_kzalloc

Conversation

@plbossart

Copy link
Copy Markdown
Member

Loading/unloading modules exposes issues with memory allocation, which
is a mix of devm_kzalloc and manual kzalloc. Move to devm_kzalloc
everywhere to simplify all this.

Signed-off-by: Pierre-Louis Bossart pierre-louis.bossart@linux.intel.com

@bardliao bardliao left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Something seems to be missed and should we keep list_del()?

Comment thread sound/soc/codecs/hdac_hdmi.c Outdated
Comment thread sound/soc/codecs/hdac_hdmi.c Outdated
Comment thread sound/soc/codecs/hdac_hdmi.c Outdated

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we keep all of the list_del()? The list may point to an unexpected address after the stuff is freed.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I assumed the structure which contains the list would be freed anyway, so not sure if there is any merit in cleaning-up the list?

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh yes, the structure itself will be freed. So it is not necessary to delete the list. Thanks.

@plbossart
plbossart force-pushed the fix/hdac_hdmi_devm_kzalloc branch from 9c7d965 to 3c71692 Compare January 3, 2019 17:42
@plbossart

Copy link
Copy Markdown
Member Author

updated code based on @bardliao's comments

@plbossart
plbossart force-pushed the fix/hdac_hdmi_devm_kzalloc branch from 3c71692 to 561e4f8 Compare January 3, 2019 18:15
Loading/unloading modules exposes issues with memory allocation, which
is a mix of devm_kzalloc and manual kzalloc. Move to devm_k routines
everywhere to simplify all this.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
@plbossart
plbossart force-pushed the fix/hdac_hdmi_devm_kzalloc branch from 561e4f8 to ea1975b Compare January 3, 2019 18:21

@bardliao bardliao left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Thanks.

@ranj063

ranj063 commented Jan 19, 2019

Copy link
Copy Markdown
Collaborator

@plbossart this PR looks good. But a general question on device managed resources. Do these resources get freed after the remove() method is finished or before?

@ranj063

ranj063 commented Jan 19, 2019

Copy link
Copy Markdown
Collaborator

@plbossart i just looked up and it looks like all devm resources are freed after the remove() completes.

@plbossart
plbossart merged commit 015f414 into thesofproject:topic/sof-dev Jan 25, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants