mirror of
https://github.com/edk2-porting/linux-next.git
synced 2024-12-26 22:24:09 +08:00
greybus: audio: fix uninitialized variable errors found by cppcheck
Currently, if info is null, the dev_err message is dereferencing an uninitialized module pointer. Instead, it should use codec->dev pointer in dev_err call and better align with other err msg in this function. Also, ret variable might be used uninitialized in a specific case. Avoid using it this way. Found using static analysis with cppcheck: Checking drivers/staging/greybus/audio_topology.c... [drivers/staging/greybus/audio_topology.c:175]: (error) Uninitialized variable: module [drivers/staging/greybus/audio_topology.c:495]: (error) Uninitialized variable: ret Reported-by: Colin Ian King <colin.king@canonical.com> Signed-off-by: Vaibhav Agarwal <vaibhav.sr@gmail.com> Acked-by: Viresh Kumar <viresh.kumar@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
dc258c15ea
commit
7224a2a50a
@ -172,7 +172,7 @@ static int gbcodec_mixer_ctl_info(struct snd_kcontrol *kcontrol,
|
||||
info = (struct gb_audio_ctl_elem_info *)data->info;
|
||||
|
||||
if (!info) {
|
||||
dev_err(module->dev, "NULL info for %s\n", uinfo->id.name);
|
||||
dev_err(codec->dev, "NULL info for %s\n", uinfo->id.name);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
@ -489,10 +489,11 @@ static int gbcodec_mixer_dapm_ctl_put(struct snd_kcontrol *kcontrol,
|
||||
dev_err_ratelimited(codec->dev,
|
||||
"%d:Error in %s for %s\n", ret,
|
||||
__func__, kcontrol->id.name);
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
|
||||
return ret;
|
||||
return 0;
|
||||
}
|
||||
|
||||
#define SOC_DAPM_MIXER_GB(xname, kcount, data) \
|
||||
|
Loading…
Reference in New Issue
Block a user