Commit ad52ad1a authored by Janusz Krzysztofik's avatar Janusz Krzysztofik Committed by Juerg Haefliger

ARM: OMAP1: ams-delta: Fix possible use of uninitialized field

BugLink: https://bugs.launchpad.net/bugs/1811080

[ Upstream commit cec83ff1 ]

While playing with initialization order of modem device, it has been
discovered that under some circumstances (early console init, I
believe) its .pm() callback may be called before the
uart_port->private_data pointer is initialized from
plat_serial8250_port->private_data, resulting in NULL pointer
dereference.  Fix it by checking for uninitialized pointer before using
it in modem_pm().

Fixes: aabf3173 ("ARM: OMAP1: ams-delta: update the modem to use regulator API")
Signed-off-by: default avatarJanusz Krzysztofik <jmkrzyszt@gmail.com>
Signed-off-by: default avatarTony Lindgren <tony@atomide.com>
Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
Signed-off-by: default avatarJuerg Haefliger <juergh@canonical.com>
Signed-off-by: default avatarStefan Bader <stefan.bader@canonical.com>
parent 748cee8c
...@@ -511,6 +511,9 @@ static void modem_pm(struct uart_port *port, unsigned int state, unsigned old) ...@@ -511,6 +511,9 @@ static void modem_pm(struct uart_port *port, unsigned int state, unsigned old)
{ {
struct modem_private_data *priv = port->private_data; struct modem_private_data *priv = port->private_data;
if (!priv)
return;
if (IS_ERR(priv->regulator)) if (IS_ERR(priv->regulator))
return; return;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment