Skip to content

Commit 0f5796d

Browse files
krzkrobherring
authored andcommitted
cpufreq: dt-platdev: Fix creating device on OPPv1 platforms
Commit 6ea891a ("cpufreq: dt-platdev: Simplify with of_machine_get_match_data()") broke several platforms which did not have OPPv2 proprety, because it incorrectly checked for device match data after first matching from "allowlist". Almost all of "allowlist" match entries do not have match data and it is expected to create platform device for them with empty data. Fix this by first checking if platform is on the allowlist with of_machine_device_match() and only then taking the match data. This duplicates the number of checks (we match against the allowlist twice), but makes the code here much smaller. Reported-by: Geert Uytterhoeven <geert@linux-m68k.org> Closes: https://lore.kernel.org/all/CAMuHMdVJD4+J9QpUUs-sX0feKfuPD72CO0dcqN7shvF_UYpZ3Q@mail.gmail.com/ Reported-by: Pavel Pisa <pisa@fel.cvut.cz> Closes: https://lore.kernel.org/all/6hnk7llbwdezh74h74fhvofbx4t4jihel5kvr6qwx2xuxxbjys@rmwbd7lkhrdz/ Fixes: 6ea891a ("cpufreq: dt-platdev: Simplify with of_machine_get_match_data()") Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@oss.qualcomm.com> Tested-by: Pavel Pisa <pisa@fel.cvut.cz> Acked-by: Viresh Kumar <viresh.kumar@linaro.org> Link: https://patch.msgid.link/20251210051718.132795-2-krzysztof.kozlowski@oss.qualcomm.com Signed-off-by: Rob Herring (Arm) <robh@kernel.org>
1 parent 512e156 commit 0f5796d

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

drivers/cpufreq/cpufreq-dt-platdev.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -219,11 +219,12 @@ static bool __init cpu0_node_has_opp_v2_prop(void)
219219

220220
static int __init cpufreq_dt_platdev_init(void)
221221
{
222-
const void *data;
222+
const void *data = NULL;
223223

224-
data = of_machine_get_match_data(allowlist);
225-
if (data)
224+
if (of_machine_device_match(allowlist)) {
225+
data = of_machine_get_match_data(allowlist);
226226
goto create_pdev;
227+
}
227228

228229
if (cpu0_node_has_opp_v2_prop() && !of_machine_device_match(blocklist))
229230
goto create_pdev;

0 commit comments

Comments
 (0)