diff mbox series

[-next] ASoC: codec: wcd938x: Fix NULL but dereferenced coccicheck error

Message ID 20220216021116.94384-1-yang.lee@linux.alibaba.com (mailing list archive)
State New, archived
Headers show
Series [-next] ASoC: codec: wcd938x: Fix NULL but dereferenced coccicheck error | expand

Commit Message

Yang Li Feb. 16, 2022, 2:11 a.m. UTC
Eliminate the following coccicheck warning:
./sound/soc/codecs/wcd938x.c:4210:21-24: ERROR: component is NULL but
dereferenced.

Reported-by: Abaci Robot <abaci@linux.alibaba.com>
Fixes: 013cc2aea0f6 ("ASoC: codec: wcd938x: Add switch control for selecting CTIA/OMTP Headset")
Signed-off-by: Yang Li <yang.lee@linux.alibaba.com>
---
 sound/soc/codecs/wcd938x.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Srinivasa Rao Mandadapu Feb. 16, 2022, 11:33 a.m. UTC | #1
On 2/16/2022 7:41 AM, Yang Li wrote:
Thanks for Fix Yang!!!
We are going to post complete cleaned patch. Shall we ignore this patch 
for now?
> Eliminate the following coccicheck warning:
> ./sound/soc/codecs/wcd938x.c:4210:21-24: ERROR: component is NULL but
> dereferenced.
>
> Reported-by: Abaci Robot <abaci@linux.alibaba.com>
> Fixes: 013cc2aea0f6 ("ASoC: codec: wcd938x: Add switch control for selecting CTIA/OMTP Headset")
> Signed-off-by: Yang Li <yang.lee@linux.alibaba.com>
> ---
>   sound/soc/codecs/wcd938x.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/sound/soc/codecs/wcd938x.c b/sound/soc/codecs/wcd938x.c
> index 2663fe0bf64f..c46c4bfd84f2 100644
> --- a/sound/soc/codecs/wcd938x.c
> +++ b/sound/soc/codecs/wcd938x.c
> @@ -4207,7 +4207,7 @@ static bool wcd938x_swap_gnd_mic(struct snd_soc_component *component, bool activ
>   	struct wcd938x_priv *wcd938x;
>   
>   	if (!component) {
> -		dev_err(component->dev, "%s component is NULL\n", __func__);
> +		pr_err("The snd_soc_component is NULL\n");
>   		return false;
>   	}
>
Yang Li Feb. 17, 2022, 2:50 a.m. UTC | #2
It's okay for me,thanks.
------------------------------------------------------------------
发件人:Srinivasa Rao Mandadapu <quic_srivasam@quicinc.com>
发送时间:2022年2月16日(星期三) 19:34
收件人:Yang Li <yang.lee@linux.alibaba.com>; perex <perex@perex.cz>
抄 送:tiwai <tiwai@suse.com>; lgirdwood <lgirdwood@gmail.com>; broonie <broonie@kernel.org>; alsa-devel <alsa-devel@alsa-project.org>; linux-kernel <linux-kernel@vger.kernel.org>; Abaci Robot <abaci@linux.alibaba.com>
主 题:Re: [PATCH -next] ASoC: codec: wcd938x: Fix NULL but dereferenced coccicheck error


On 2/16/2022 7:41 AM, Yang Li wrote:
Thanks for Fix Yang!!!
We are going to post complete cleaned patch. Shall we ignore this patch 
for now?
> Eliminate the following coccicheck warning:
> ./sound/soc/codecs/wcd938x.c:4210:21-24: ERROR: component is NULL but
> dereferenced.
>
> Reported-by: Abaci Robot <abaci@linux.alibaba.com>
> Fixes: 013cc2aea0f6 ("ASoC: codec: wcd938x: Add switch control for selecting CTIA/OMTP Headset")
> Signed-off-by: Yang Li <yang.lee@linux.alibaba.com>
> ---
>   sound/soc/codecs/wcd938x.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/sound/soc/codecs/wcd938x.c b/sound/soc/codecs/wcd938x.c
> index 2663fe0bf64f..c46c4bfd84f2 100644
> --- a/sound/soc/codecs/wcd938x.c
> +++ b/sound/soc/codecs/wcd938x.c
> @@ -4207,7 +4207,7 @@ static bool wcd938x_swap_gnd_mic(struct snd_soc_component *component, bool activ
>    struct wcd938x_priv *wcd938x;
>   
>    if (!component) {
> -  dev_err(component->dev, "%s component is NULL\n", __func__);
> +  pr_err("The snd_soc_component is NULL\n");
>     return false;
>    }
>
diff mbox series

Patch

diff --git a/sound/soc/codecs/wcd938x.c b/sound/soc/codecs/wcd938x.c
index 2663fe0bf64f..c46c4bfd84f2 100644
--- a/sound/soc/codecs/wcd938x.c
+++ b/sound/soc/codecs/wcd938x.c
@@ -4207,7 +4207,7 @@  static bool wcd938x_swap_gnd_mic(struct snd_soc_component *component, bool activ
 	struct wcd938x_priv *wcd938x;
 
 	if (!component) {
-		dev_err(component->dev, "%s component is NULL\n", __func__);
+		pr_err("The snd_soc_component is NULL\n");
 		return false;
 	}