pmdomain: imx8mp-blk-ctrl: Error out if domains are missing in DT
authorMarek Vasut <marex@denx.de>
Fri, 19 Jan 2024 01:47:41 +0000 (02:47 +0100)
committerUlf Hansson <ulf.hansson@linaro.org>
Wed, 14 Feb 2024 09:26:11 +0000 (10:26 +0100)
commitd9e473513930836e617f36c066f205a9a0c4450a
tree65fd499f4a9a59358cf59a833e7717a857b1844d
parent5d7f58ee08434a33340f75ac7ac5071eea9673b3
pmdomain: imx8mp-blk-ctrl: Error out if domains are missing in DT

This driver assumes that domain->power_dev is non-NULL in its
suspend/resume path. The assumption is valid, since all the devices that
are being looked up here should be described in DT. In case they are not
described in DT, because the DT is faulty, suspend/resume attempt would
trigger NULL pointer dereference.

To avoid this failure, check whether the power_dev assignment is not NULL
right away in probe callback and fail early if it is.

Signed-off-by: Marek Vasut <marex@denx.de>
Reviewed-by: Peng Fan <peng.fan@nxp.com>
Link: https://lore.kernel.org/r/20240119014807.268694-1-marex@denx.de
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
drivers/pmdomain/imx/imx8m-blk-ctrl.c
drivers/pmdomain/imx/imx8mp-blk-ctrl.c