Commit aa315c96 authored by Antti Palosaari's avatar Antti Palosaari Committed by Greg Kroah-Hartman

cxd2820r: fix gpio null pointer dereference

commit 0ffb94b6 upstream.

Setting GPIOs during probe causes null pointer deference when
GPIOLIB was not selected by Kconfig. Initialize driver private
field before calling set gpios.

It is regressing bug since 4.9.

Fixes: 07fdf7d9 ("[media] cxd2820r: add I2C driver bindings")
Reported-by: default avatarChris Rankin <rankincj@gmail.com>
Tested-by: default avatarChris Rankin <rankincj@gmail.com>
Tested-by: default avatarHåkan Lennestål <hakan.lennestal@gmail.com>
Signed-off-by: default avatarAntti Palosaari <crope@iki.fi>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@s-opensource.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent a1403c57
...@@ -615,6 +615,7 @@ static int cxd2820r_probe(struct i2c_client *client, ...@@ -615,6 +615,7 @@ static int cxd2820r_probe(struct i2c_client *client,
} }
priv->client[0] = client; priv->client[0] = client;
priv->fe.demodulator_priv = priv;
priv->i2c = client->adapter; priv->i2c = client->adapter;
priv->ts_mode = pdata->ts_mode; priv->ts_mode = pdata->ts_mode;
priv->ts_clk_inv = pdata->ts_clk_inv; priv->ts_clk_inv = pdata->ts_clk_inv;
...@@ -697,7 +698,6 @@ static int cxd2820r_probe(struct i2c_client *client, ...@@ -697,7 +698,6 @@ static int cxd2820r_probe(struct i2c_client *client,
memcpy(&priv->fe.ops, &cxd2820r_ops, sizeof(priv->fe.ops)); memcpy(&priv->fe.ops, &cxd2820r_ops, sizeof(priv->fe.ops));
if (!pdata->attach_in_use) if (!pdata->attach_in_use)
priv->fe.ops.release = NULL; priv->fe.ops.release = NULL;
priv->fe.demodulator_priv = priv;
i2c_set_clientdata(client, priv); i2c_set_clientdata(client, priv);
/* Setup callbacks */ /* Setup callbacks */
......
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