PM / devfreq: rk3399_dmc: Fix kernel oops when rockchip,pmu is absent
authorMarc Zyngier <maz@kernel.org>
Tue, 30 Jun 2020 10:05:46 +0000 (11:05 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 19 Aug 2020 06:24:16 +0000 (08:24 +0200)
commitde85cf79ef7d645b39f2e51658044783021ea62a
treecc1f1b7f291c9a212ee62b8a0076456be91baf43
parent123d7603cbcaceaa4f513be5b7c60ba16746d73e
PM / devfreq: rk3399_dmc: Fix kernel oops when rockchip,pmu is absent

commit 63ef91f24f9bfc70b6446319f6cabfd094481372 upstream.

Booting a recent kernel on a rk3399-based system (nanopc-t4),
equipped with a recent u-boot and ATF results in an Oops due
to a NULL pointer dereference.

This turns out to be due to the rk3399-dmc driver looking for
an *undocumented* property (rockchip,pmu), and happily using
a NULL pointer when the property isn't there.

Instead, make most of what was brought in with 9173c5ceb035
("PM / devfreq: rk3399_dmc: Pass ODT and auto power down parameters
to TF-A.") conditioned on finding this property in the device-tree,
preventing the driver from exploding.

Cc: stable@vger.kernel.org
Fixes: 9173c5ceb035 ("PM / devfreq: rk3399_dmc: Pass ODT and auto power down parameters to TF-A.")
Signed-off-by: Marc Zyngier <maz@kernel.org>
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/devfreq/rk3399_dmc.c