aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPeng Fan <peng.fan@nxp.com>2021-02-25 11:10:04 +0800
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2021-05-11 14:47:26 +0200
commit79315ebff4323a098b198348a3bbeae52cb5e4dc (patch)
treef3a7be242dddfe55094098c55f8989e97df98c86
parent47ac226199f09bb340f6d6ddf02b29e2bb644b6f (diff)
downloadkernel_replicant_linux-79315ebff4323a098b198348a3bbeae52cb5e4dc.tar.gz
kernel_replicant_linux-79315ebff4323a098b198348a3bbeae52cb5e4dc.tar.bz2
kernel_replicant_linux-79315ebff4323a098b198348a3bbeae52cb5e4dc.zip
mmc: sdhci-esdhc-imx: validate pinctrl before use it
[ Upstream commit f410ee0aa2df050a9505f5c261953e9b18e21206 ] When imx_data->pinctrl is not a valid pointer, pinctrl_lookup_state will trigger kernel panic. When we boot Dual OS on Jailhouse hypervisor, we let the 1st Linux to configure pinmux ready for the 2nd OS, so the 2nd OS not have pinctrl settings. Similar to this commit b62eee9f804e ("mmc: sdhci-esdhc-imx: no fail when no pinctrl available"). Reviewed-by: Bough Chen <haobo.chen@nxp.com> Reviewed-by: Alice Guo <alice.guo@nxp.com> Signed-off-by: Peng Fan <peng.fan@nxp.com> Link: https://lore.kernel.org/r/1614222604-27066-6-git-send-email-peng.fan@oss.nxp.com Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
-rw-r--r--drivers/mmc/host/sdhci-esdhc-imx.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/mmc/host/sdhci-esdhc-imx.c b/drivers/mmc/host/sdhci-esdhc-imx.c
index 5d9b3106d2f7..d28809e47962 100644
--- a/drivers/mmc/host/sdhci-esdhc-imx.c
+++ b/drivers/mmc/host/sdhci-esdhc-imx.c
@@ -1504,7 +1504,7 @@ sdhci_esdhc_imx_probe_dt(struct platform_device *pdev,
mmc_of_parse_voltage(np, &host->ocr_mask);
- if (esdhc_is_usdhc(imx_data)) {
+ if (esdhc_is_usdhc(imx_data) && !IS_ERR(imx_data->pinctrl)) {
imx_data->pins_100mhz = pinctrl_lookup_state(imx_data->pinctrl,
ESDHC_PINCTRL_STATE_100MHZ);
imx_data->pins_200mhz = pinctrl_lookup_state(imx_data->pinctrl,