-
Notifications
You must be signed in to change notification settings - Fork 151
ASoC: SOF: ipc4-compress: Add NULL checks for pcm_ops #5905
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: topic/sof-dev
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -107,6 +107,9 @@ static int sof_ipc4_compr_stream_free(struct snd_sof_dev *sdev, | |
| int ret = 0; | ||
| int err = 0; | ||
|
|
||
| if (!pcm_ops) | ||
| return -EINVAL; | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this is granted to be not NULL. |
||
|
|
||
| if (spcm->prepared[dir]) { | ||
| if (spcm->pending_stop[dir]) | ||
| pcm_ops->trigger(sdev->component, NULL, spcm, | ||
|
|
@@ -542,6 +545,9 @@ static int sof_ipc4_compr_trigger(struct snd_soc_component *component, | |
| bool trigger_platform = false; | ||
| int ret = 0; | ||
|
|
||
| if (!pcm_ops || !pcm_ops->trigger) | ||
| return -EINVAL; | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. all of this is granted. The report is bogus.
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Only reason for this PR is,
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, static analyzer is wrong.
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Even other soc-vendors also observes similar issue - but atleast with this PR, Intel is fine Else do you recommend to handle this at macro level(something like correcting sof_ipc_get_ops() in sof-priv.h), instead of scattering NULL checks in individual audio stream. |
||
|
|
||
| spcm = snd_sof_find_spcm_dai(component, rtd); | ||
| if (!spcm) { | ||
| dev_err(sdev->dev, "%s: can't find spcm\n", __func__); | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ujfalusi Is it possible be NULL?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
During normal stream ops
sdev->ipc->opsis always set, sopcm_opswill not be NULL at runtime.But
sof_ipc_get_ops(sdev, pcm)evaluates to((sdev)->ipc && (sdev)->ipc->ops) ? (sdev)->ipc->ops->pcm : NULL
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes? This is granted to be never NULL.