Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Input: melfas_mip4 - ensure that device is present

Try a quick read from the device in mip4_query_device() to make sure
that the device is there, as we do not consider failures to retrieve
product name or resolution fatal.

Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>

+11
+11
drivers/input/touchscreen/melfas_mip4.c
··· 253 253 */ 254 254 static int mip4_query_device(struct mip4_ts *ts) 255 255 { 256 + union i2c_smbus_data dummy; 256 257 int error; 257 258 u8 cmd[2]; 258 259 u8 buf[14]; 260 + 261 + /* 262 + * Make sure there is something at this address as we do not 263 + * consider subsequent failures as fatal. 264 + */ 265 + if (i2c_smbus_xfer(ts->client->adapter, ts->client->addr, 266 + 0, I2C_SMBUS_READ, 0, I2C_SMBUS_BYTE, &dummy) < 0) { 267 + dev_err(&ts->client->dev, "nothing at this address\n"); 268 + return -ENXIO; 269 + } 259 270 260 271 /* Product name */ 261 272 cmd[0] = MIP4_R0_INFO;