<feed xmlns='http://www.w3.org/2005/Atom'>
<title>kernel/linux.git/drivers/opp/core.c, branch v6.1.124</title>
<subtitle>Linux kernel stable tree (mirror)</subtitle>
<id>https://git.radix-linux.su/kernel/linux.git/atom?h=v6.1.124</id>
<link rel='self' href='https://git.radix-linux.su/kernel/linux.git/atom?h=v6.1.124'/>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/'/>
<updated>2024-02-01T00:16:58+00:00</updated>
<entry>
<title>OPP: Pass rounded rate to _set_opp()</title>
<updated>2024-02-01T00:16:58+00:00</updated>
<author>
<name>Viresh Kumar</name>
<email>viresh.kumar@linaro.org</email>
</author>
<published>2024-01-05T08:25:37+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=29e2da3eabd8dd793b9c8aa0318acb97a41aa153'/>
<id>urn:sha1:29e2da3eabd8dd793b9c8aa0318acb97a41aa153</id>
<content type='text'>
commit 7269c250db1b89cda72ca419b7bd5e37997309d6 upstream.

The OPP core finds the eventual frequency to set with the help of
clk_round_rate() and the same was earlier getting passed to _set_opp()
and that's what would get configured.

The commit 1efae8d2e777 ("OPP: Make dev_pm_opp_set_opp() independent of
frequency") mistakenly changed that. Fix it.

Fixes: 1efae8d2e777 ("OPP: Make dev_pm_opp_set_opp() independent of frequency")
Cc: v5.18+ &lt;stable@vger.kernel.org&gt; # v6.0+
Signed-off-by: Viresh Kumar &lt;viresh.kumar@linaro.org&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>OPP: Fix passing 0 to PTR_ERR in _opp_attach_genpd()</title>
<updated>2023-09-13T07:42:28+00:00</updated>
<author>
<name>Manivannan Sadhasivam</name>
<email>manivannan.sadhasivam@linaro.org</email>
</author>
<published>2023-07-21T12:46:34+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=5d343b49078de9fbdce2dd0ec894f5b8daeb1031'/>
<id>urn:sha1:5d343b49078de9fbdce2dd0ec894f5b8daeb1031</id>
<content type='text'>
[ Upstream commit d920920f85a82c1c806a4143871a0e8f534732f2 ]

If dev_pm_domain_attach_by_name() returns NULL, then 0 will be passed to
PTR_ERR() as reported by the smatch warning below:

drivers/opp/core.c:2456 _opp_attach_genpd() warn: passing zero to 'PTR_ERR'

Fix it by checking for the non-NULL virt_dev pointer before passing it to
PTR_ERR. Otherwise return -ENODEV.

Fixes: 4ea9496cbc95 ("opp: Fix error check in dev_pm_opp_attach_genpd()")
Signed-off-by: Manivannan Sadhasivam &lt;manivannan.sadhasivam@linaro.org&gt;
Signed-off-by: Viresh Kumar &lt;viresh.kumar@linaro.org&gt;
Signed-off-by: Sasha Levin &lt;sashal@kernel.org&gt;
</content>
</entry>
<entry>
<title>opp: Fix use-after-free in lazy_opp_tables after probe deferral</title>
<updated>2023-07-23T11:49:42+00:00</updated>
<author>
<name>Stephan Gerhold</name>
<email>stephan.gerhold@kernkonzept.com</email>
</author>
<published>2023-05-30T15:54:46+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=76ab057de777723ec924654502d1a260ba7d7d54'/>
<id>urn:sha1:76ab057de777723ec924654502d1a260ba7d7d54</id>
<content type='text'>
commit b2a2ab039bd58f51355e33d7d3fc64605d7f870d upstream.

When dev_pm_opp_of_find_icc_paths() in _allocate_opp_table() returns
-EPROBE_DEFER, the opp_table is freed again, to wait until all the
interconnect paths are available.

However, if the OPP table is using required-opps then it may already
have been added to the global lazy_opp_tables list. The error path
does not remove the opp_table from the list again.

This can cause crashes later when the provider of the required-opps
is added, since we will iterate over OPP tables that have already been
freed. E.g.:

  Unable to handle kernel NULL pointer dereference when read
  CPU: 0 PID: 7 Comm: kworker/0:0 Not tainted 6.4.0-rc3
  PC is at _of_add_opp_table_v2 (include/linux/of.h:949
  drivers/opp/of.c:98 drivers/opp/of.c:344 drivers/opp/of.c:404
  drivers/opp/of.c:1032) -&gt; lazy_link_required_opp_table()

Fix this by calling _of_clear_opp_table() to remove the opp_table from
the list and clear other allocated resources. While at it, also add the
missing mutex_destroy() calls in the error path.

Cc: stable@vger.kernel.org
Suggested-by: Viresh Kumar &lt;viresh.kumar@linaro.org&gt;
Fixes: 7eba0c7641b0 ("opp: Allow lazy-linking of required-opps")
Signed-off-by: Stephan Gerhold &lt;stephan.gerhold@kernkonzept.com&gt;
Signed-off-by: Viresh Kumar &lt;viresh.kumar@linaro.org&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>OPP: Fix an un-initialized variable usage</title>
<updated>2022-08-16T05:18:08+00:00</updated>
<author>
<name>Christophe JAILLET</name>
<email>christophe.jaillet@wanadoo.fr</email>
</author>
<published>2022-08-15T12:44:37+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=d36cb843e456324d6e725f1d8b440c4645a52d0d'/>
<id>urn:sha1:d36cb843e456324d6e725f1d8b440c4645a52d0d</id>
<content type='text'>
smatch complains that 'ret' may be returned un-initialized.

Explicitly return 0 if we reach the end of the function (should
'opp_table-&gt;clk_count' be 0).

Fixes: 8174a3a613af ("OPP: Provide a simple implementation to configure multiple clocks")
Signed-off-by: Christophe JAILLET &lt;christophe.jaillet@wanadoo.fr&gt;
Signed-off-by: Viresh Kumar &lt;viresh.kumar@linaro.org&gt;
</content>
</entry>
<entry>
<title>OPP: Don't drop opp-&gt;np reference while it is still in use</title>
<updated>2022-07-19T05:37:02+00:00</updated>
<author>
<name>Liang He</name>
<email>windhl@126.com</email>
</author>
<published>2022-07-18T13:36:32+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=3466ea2cd6b66e4647a9af2381c0d0cd3d579354'/>
<id>urn:sha1:3466ea2cd6b66e4647a9af2381c0d0cd3d579354</id>
<content type='text'>
The struct dev_pm_opp contains a reference of the DT node, opp-&gt;np,
throughout its lifetime. We should increase the refcount for the same
from _opp_add_static_v2(), and drop it while removing the OPP finally.

Signed-off-by: Liang He &lt;windhl@126.com&gt;
[ Viresh: Updated subject / commit log, create _of_clear_opp() and drop
	  reference from it]
Signed-off-by: Viresh Kumar &lt;viresh.kumar@linaro.org&gt;
</content>
</entry>
<entry>
<title>OPP: Allow config_clks helper for single clk case</title>
<updated>2022-07-12T15:05:21+00:00</updated>
<author>
<name>Viresh Kumar</name>
<email>viresh.kumar@linaro.org</email>
</author>
<published>2022-07-04T15:37:28+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=2f71ae1a9e75a675dfc9da03f5e191e858d1126f'/>
<id>urn:sha1:2f71ae1a9e75a675dfc9da03f5e191e858d1126f</id>
<content type='text'>
There is a corner case with Tegra30, where we want to skip clk
configuration via dev_pm_opp_set_opp(), but still want the OPP core to
read the "opp-hz" property so we can find the right OPP via freq finding
helpers.

This is the easiest of the ways to make it work, without any special
hacks in the OPP core. Allow config_clks to be passed for single clk
case.

Tested-by: Dmitry Osipenko &lt;dmitry.osipenko@collabora.com&gt;
Signed-off-by: Viresh Kumar &lt;viresh.kumar@linaro.org&gt;
</content>
</entry>
<entry>
<title>OPP: Provide a simple implementation to configure multiple clocks</title>
<updated>2022-07-12T15:05:21+00:00</updated>
<author>
<name>Viresh Kumar</name>
<email>viresh.kumar@linaro.org</email>
</author>
<published>2022-06-10T07:07:25+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=8174a3a613af1a911ab19da812824f7180b261f9'/>
<id>urn:sha1:8174a3a613af1a911ab19da812824f7180b261f9</id>
<content type='text'>
This provides a simple implementation to configure multiple clocks for a
device.

Tested-by: Dmitry Osipenko &lt;dmitry.osipenko@collabora.com&gt;
Signed-off-by: Viresh Kumar &lt;viresh.kumar@linaro.org&gt;
</content>
</entry>
<entry>
<title>OPP: Assert clk_count == 1 for single clk helpers</title>
<updated>2022-07-12T15:05:20+00:00</updated>
<author>
<name>Viresh Kumar</name>
<email>viresh.kumar@linaro.org</email>
</author>
<published>2022-06-10T04:57:51+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=f123ea74511dfab70598cd584a11ad596454a689'/>
<id>urn:sha1:f123ea74511dfab70598cd584a11ad596454a689</id>
<content type='text'>
Many helpers can be safely called only for devices that have a single
clk associated with them. Assert the same for those routines.

Tested-by: Dmitry Osipenko &lt;dmitry.osipenko@collabora.com&gt;
Signed-off-by: Viresh Kumar &lt;viresh.kumar@linaro.org&gt;
</content>
</entry>
<entry>
<title>OPP: Add key specific assert() method to key finding helpers</title>
<updated>2022-07-12T15:05:20+00:00</updated>
<author>
<name>Viresh Kumar</name>
<email>viresh.kumar@linaro.org</email>
</author>
<published>2022-06-10T04:10:30+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=e10a46443f767cc6be201a10c767745f0afc04ac'/>
<id>urn:sha1:e10a46443f767cc6be201a10c767745f0afc04ac</id>
<content type='text'>
The helpers for the clock key, at least, would need to assert that the
helpers are called only for single clock case. Prepare for that by
adding an argument to the key finding helpers.

Tested-by: Dmitry Osipenko &lt;dmitry.osipenko@collabora.com&gt;
Signed-off-by: Viresh Kumar &lt;viresh.kumar@linaro.org&gt;
</content>
</entry>
<entry>
<title>OPP: Compare bandwidths for all paths in _opp_compare_key()</title>
<updated>2022-07-12T15:05:20+00:00</updated>
<author>
<name>Viresh Kumar</name>
<email>viresh.kumar@linaro.org</email>
</author>
<published>2022-07-05T06:20:47+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=274c3e83e7d9bf4361fd30648f5c9414c806135c'/>
<id>urn:sha1:274c3e83e7d9bf4361fd30648f5c9414c806135c</id>
<content type='text'>
Replicate the same behavior as "rates" here and compare all values
instead of relying on the first entry alone.

Signed-off-by: Viresh Kumar &lt;viresh.kumar@linaro.org&gt;
</content>
</entry>
</feed>
