iio: ch101: Return -ENODEV when get expander GPIO failed

After get expander GPIO failed, the driver should exit probe,
or else it will cause kernel crash in suspend process.

CRs-Fixed: 2880848
Change-Id: Ie06031e0fbc27ea00d646797c86a650748b5ccb6
Signed-off-by: Zhenlin Lian <lianzhenlin@codeaurora.org>
This commit is contained in:
Zhenlin Lian 2021-02-23 09:14:10 +05:30
parent c14f9cb7b5
commit e6f2a6d5df

View File

@ -335,6 +335,7 @@ static int ch101_i2c_probe(struct i2c_client *client,
if (!gpio) {
dev_err(dev, "Error initializing expander: %s\n",
SX1508_DEVICE_ID);
return -ENODEV;
}
cbk->read_reg = read_reg;