All of lore.kernel.org
 help / color / mirror / Atom feed
* [bug report] opp: Remove bandwidth votes when target_freq is zero
@ 2020-05-29  8:41 Dan Carpenter
  2020-05-29  8:53 ` Viresh Kumar
  0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2020-05-29  8:41 UTC (permalink / raw)
  To: viresh.kumar; +Cc: linux-pm

Hello Viresh Kumar,

The patch c57afacc9270: "opp: Remove bandwidth votes when target_freq
is zero" from May 27, 2020, leads to the following static checker
warning:

	drivers/opp/core.c:875 dev_pm_opp_set_rate()
	error: uninitialized symbol 'opp'.

drivers/opp/core.c
   844   */
   845  int dev_pm_opp_set_rate(struct device *dev, unsigned long target_freq)
   846  {
   847          struct opp_table *opp_table;
   848          unsigned long freq, old_freq, temp_freq;
   849          struct dev_pm_opp *old_opp, *opp;
                                             ^^^

   850          struct clk *clk;
   851          int ret;
   852  
   853          opp_table = _find_opp_table(dev);
   854          if (IS_ERR(opp_table)) {
   855                  dev_err(dev, "%s: device opp doesn't exist\n", __func__);
   856                  return PTR_ERR(opp_table);
   857          }
   858  
   859          if (unlikely(!target_freq)) {
   860                  /*
   861                   * Some drivers need to support cases where some platforms may
   862                   * have OPP table for the device, while others don't and
   863                   * opp_set_rate() just needs to behave like clk_set_rate().
   864                   */
   865                  if (!_get_opp_count(opp_table))
   866                          return 0;
   867  
   868                  if (!opp_table->required_opp_tables && !opp_table->regulators &&
   869                      !opp_table->paths) {
   870                          dev_err(dev, "target frequency can't be 0\n");
   871                          ret = -EINVAL;
   872                          goto put_opp_table;
   873                  }
   874  
   875                  ret = _set_opp_bw(opp_table, opp, dev, true);
                                                     ^^^
Not initialized.

   876                  if (ret)
   877                          return ret;
   878  
   879                  if (opp_table->regulator_enabled) {
   880                          regulator_disable(opp_table->regulators[0]);
   881                          opp_table->regulator_enabled = false;
   882                  }

regards,
dan carpenter

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

* Re: [bug report] opp: Remove bandwidth votes when target_freq is zero
  2020-05-29  8:41 [bug report] opp: Remove bandwidth votes when target_freq is zero Dan Carpenter
@ 2020-05-29  8:53 ` Viresh Kumar
  0 siblings, 0 replies; 2+ messages in thread
From: Viresh Kumar @ 2020-05-29  8:53 UTC (permalink / raw)
  To: Dan Carpenter; +Cc: linux-pm

On 29-05-20, 11:41, Dan Carpenter wrote:
> Hello Viresh Kumar,
> 
> The patch c57afacc9270: "opp: Remove bandwidth votes when target_freq
> is zero" from May 27, 2020, leads to the following static checker
> warning:
> 
> 	drivers/opp/core.c:875 dev_pm_opp_set_rate()
> 	error: uninitialized symbol 'opp'.
> 
> drivers/opp/core.c
>    844   */
>    845  int dev_pm_opp_set_rate(struct device *dev, unsigned long target_freq)
>    846  {
>    847          struct opp_table *opp_table;
>    848          unsigned long freq, old_freq, temp_freq;
>    849          struct dev_pm_opp *old_opp, *opp;
>                                              ^^^
> 
>    850          struct clk *clk;
>    851          int ret;
>    852  
>    853          opp_table = _find_opp_table(dev);
>    854          if (IS_ERR(opp_table)) {
>    855                  dev_err(dev, "%s: device opp doesn't exist\n", __func__);
>    856                  return PTR_ERR(opp_table);
>    857          }
>    858  
>    859          if (unlikely(!target_freq)) {
>    860                  /*
>    861                   * Some drivers need to support cases where some platforms may
>    862                   * have OPP table for the device, while others don't and
>    863                   * opp_set_rate() just needs to behave like clk_set_rate().
>    864                   */
>    865                  if (!_get_opp_count(opp_table))
>    866                          return 0;
>    867  
>    868                  if (!opp_table->required_opp_tables && !opp_table->regulators &&
>    869                      !opp_table->paths) {
>    870                          dev_err(dev, "target frequency can't be 0\n");
>    871                          ret = -EINVAL;
>    872                          goto put_opp_table;
>    873                  }
>    874  
>    875                  ret = _set_opp_bw(opp_table, opp, dev, true);
>                                                      ^^^
> Not initialized.
> 
>    876                  if (ret)
>    877                          return ret;
>    878  
>    879                  if (opp_table->regulator_enabled) {
>    880                          regulator_disable(opp_table->regulators[0]);
>    881                          opp_table->regulator_enabled = false;
>    882                  }

Thanks. I have already fixed and pushed the fix yesterday.

-- 
viresh

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

end of thread, other threads:[~2020-05-29  8:53 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-05-29  8:41 [bug report] opp: Remove bandwidth votes when target_freq is zero Dan Carpenter
2020-05-29  8:53 ` Viresh Kumar

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.