All of lore.kernel.org
 help / color / mirror / Atom feed
* [bug report] ASoC: mediatek: implement mediatek common structure
@ 2021-08-27  8:57 ` Dan Carpenter
  0 siblings, 0 replies; 4+ messages in thread
From: Dan Carpenter @ 2021-08-27  8:57 UTC (permalink / raw)
  To: garlic.tseng; +Cc: alsa-devel, linux-mediatek

Hello Garlic Tseng,

The patch 283b612429a2: "ASoC: mediatek: implement mediatek common
structure" from Jun 17, 2016, leads to the following
Smatch static checker warning:

	sound/soc/mediatek/common/mtk-afe-fe-dai.c:364 mtk_afe_resume()
	error: we previously assumed 'afe->reg_back_up' could be null (see line 359)

sound/soc/mediatek/common/mtk-afe-fe-dai.c
    354         if (pm_runtime_status_suspended(dev) || !afe->suspended)
    355                 return 0;
    356 
    357         afe->runtime_resume(dev);
    358 
    359         if (!afe->reg_back_up)
    360                 dev_dbg(dev, "%s no reg_backup\n", __func__);

Should this return?  Also when ->reg_back_up is allocated there is no
check for NULL so it seems like a very possible condition.

    361 
    362         for (i = 0; i < afe->reg_back_up_list_num; i++)
    363                 mtk_regmap_write(regmap, afe->reg_back_up_list[i],
--> 364                                  afe->reg_back_up[i]);
    365 
    366         afe->suspended = false;
    367         return 0;
    368 }

regards,
dan carpenter

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [bug report] ASoC: mediatek: implement mediatek common structure
@ 2021-08-27  8:57 ` Dan Carpenter
  0 siblings, 0 replies; 4+ messages in thread
From: Dan Carpenter @ 2021-08-27  8:57 UTC (permalink / raw)
  To: garlic.tseng; +Cc: alsa-devel, linux-mediatek

Hello Garlic Tseng,

The patch 283b612429a2: "ASoC: mediatek: implement mediatek common
structure" from Jun 17, 2016, leads to the following
Smatch static checker warning:

	sound/soc/mediatek/common/mtk-afe-fe-dai.c:364 mtk_afe_resume()
	error: we previously assumed 'afe->reg_back_up' could be null (see line 359)

sound/soc/mediatek/common/mtk-afe-fe-dai.c
    354         if (pm_runtime_status_suspended(dev) || !afe->suspended)
    355                 return 0;
    356 
    357         afe->runtime_resume(dev);
    358 
    359         if (!afe->reg_back_up)
    360                 dev_dbg(dev, "%s no reg_backup\n", __func__);

Should this return?  Also when ->reg_back_up is allocated there is no
check for NULL so it seems like a very possible condition.

    361 
    362         for (i = 0; i < afe->reg_back_up_list_num; i++)
    363                 mtk_regmap_write(regmap, afe->reg_back_up_list[i],
--> 364                                  afe->reg_back_up[i]);
    365 
    366         afe->suspended = false;
    367         return 0;
    368 }

regards,
dan carpenter

_______________________________________________
Linux-mediatek mailing list
Linux-mediatek@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-mediatek

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [bug report] ASoC: mediatek: implement mediatek common structure
  2021-08-27  8:57 ` Dan Carpenter
@ 2021-08-30  7:43   ` Trevor Wu
  -1 siblings, 0 replies; 4+ messages in thread
From: Trevor Wu @ 2021-08-30  7:43 UTC (permalink / raw)
  To: Dan Carpenter, garlic.tseng; +Cc: alsa-devel, linux-mediatek, trevor.wu

Hi Dan,

Garlic has left mediatek, so I will help this problem.
Thank you for pointing out the problem.
It seems that some handling for NULL case should be added to
suspend/resume funtion.
I will send a patch for the problem.

Thanks,
Trevor


On Fri, 2021-08-27 at 11:57 +0300, Dan Carpenter wrote:
> Hello Garlic Tseng,
> 
> The patch 283b612429a2: "ASoC: mediatek: implement mediatek common
> structure" from Jun 17, 2016, leads to the following
> Smatch static checker warning:
> 
> 	sound/soc/mediatek/common/mtk-afe-fe-dai.c:364 mtk_afe_resume()
> 	error: we previously assumed 'afe->reg_back_up' could be null
> (see line 359)
> 
> sound/soc/mediatek/common/mtk-afe-fe-dai.c
>     354         if (pm_runtime_status_suspended(dev) || !afe-
> >suspended)
>     355                 return 0;
>     356 
>     357         afe->runtime_resume(dev);
>     358 
>     359         if (!afe->reg_back_up)
>     360                 dev_dbg(dev, "%s no reg_backup\n", __func__);
> 
> Should this return?  Also when ->reg_back_up is allocated there is no
> check for NULL so it seems like a very possible condition.
> 
>     361 
>     362         for (i = 0; i < afe->reg_back_up_list_num; i++)
>     363                 mtk_regmap_write(regmap, afe-
> >reg_back_up_list[i],
> --> 364                                  afe->reg_back_up[i]);
>     365 
>     366         afe->suspended = false;
>     367         return 0;
>     368 }
> 
> regards,
> dan carpenter
> 
> _______________________________________________
> Linux-mediatek mailing list
> Linux-mediatek@lists.infradead.org
> 
https://urldefense.com/v3/__http://lists.infradead.org/mailman/listinfo/linux-mediatek__;!!CTRNKA9wMg0ARbw!3mMCbxx-YFIMMsBt65G7RuCRYOyFvPR_ZdB9SjdWOhElHVtsE6cAas4nmodLGDHR6w$
>  
_______________________________________________
Linux-mediatek mailing list
Linux-mediatek@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-mediatek

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [bug report] ASoC: mediatek: implement mediatek common structure
@ 2021-08-30  7:43   ` Trevor Wu
  0 siblings, 0 replies; 4+ messages in thread
From: Trevor Wu @ 2021-08-30  7:43 UTC (permalink / raw)
  To: Dan Carpenter, garlic.tseng; +Cc: alsa-devel, linux-mediatek, trevor.wu

Hi Dan,

Garlic has left mediatek, so I will help this problem.
Thank you for pointing out the problem.
It seems that some handling for NULL case should be added to
suspend/resume funtion.
I will send a patch for the problem.

Thanks,
Trevor


On Fri, 2021-08-27 at 11:57 +0300, Dan Carpenter wrote:
> Hello Garlic Tseng,
> 
> The patch 283b612429a2: "ASoC: mediatek: implement mediatek common
> structure" from Jun 17, 2016, leads to the following
> Smatch static checker warning:
> 
> 	sound/soc/mediatek/common/mtk-afe-fe-dai.c:364 mtk_afe_resume()
> 	error: we previously assumed 'afe->reg_back_up' could be null
> (see line 359)
> 
> sound/soc/mediatek/common/mtk-afe-fe-dai.c
>     354         if (pm_runtime_status_suspended(dev) || !afe-
> >suspended)
>     355                 return 0;
>     356 
>     357         afe->runtime_resume(dev);
>     358 
>     359         if (!afe->reg_back_up)
>     360                 dev_dbg(dev, "%s no reg_backup\n", __func__);
> 
> Should this return?  Also when ->reg_back_up is allocated there is no
> check for NULL so it seems like a very possible condition.
> 
>     361 
>     362         for (i = 0; i < afe->reg_back_up_list_num; i++)
>     363                 mtk_regmap_write(regmap, afe-
> >reg_back_up_list[i],
> --> 364                                  afe->reg_back_up[i]);
>     365 
>     366         afe->suspended = false;
>     367         return 0;
>     368 }
> 
> regards,
> dan carpenter
> 
> _______________________________________________
> Linux-mediatek mailing list
> Linux-mediatek@lists.infradead.org
> 
https://urldefense.com/v3/__http://lists.infradead.org/mailman/listinfo/linux-mediatek__;!!CTRNKA9wMg0ARbw!3mMCbxx-YFIMMsBt65G7RuCRYOyFvPR_ZdB9SjdWOhElHVtsE6cAas4nmodLGDHR6w$
>  

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2021-08-30  7:44 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-27  8:57 [bug report] ASoC: mediatek: implement mediatek common structure Dan Carpenter
2021-08-27  8:57 ` Dan Carpenter
2021-08-30  7:43 ` Trevor Wu
2021-08-30  7:43   ` Trevor Wu

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.