CC [M] drivers/staging/iio/light/tsl2563.o drivers/staging/iio/light/tsl2563.c: In function 'tsl2563_probe': drivers/staging/iio/light/tsl2563.c:736: warning: 'id' may be used uninitialized in this function Also fixes the tsl2563_read_id(). Signed-off-by: Maxin B. John <maxin.john@xxxxxxxxx> --- diff --git a/drivers/staging/iio/light/tsl2563.c b/drivers/staging/iio/light/tsl2563.c index f25243b..f8f787d 100644 --- a/drivers/staging/iio/light/tsl2563.c +++ b/drivers/staging/iio/light/tsl2563.c @@ -225,9 +225,9 @@ static int tsl2563_read_id(struct tsl2563_chip *chip, u8 *id) ret = i2c_smbus_read_byte_data(client, TSL2563_CMD | TSL2563_REG_ID); if (ret < 0) - return ret; + return -EIO; - return 0; + return ret; } /* @@ -697,7 +697,7 @@ static int __devinit tsl2563_probe(struct i2c_client *client, struct tsl2563_platform_data *pdata = client->dev.platform_data; int err = 0; int ret; - u8 id; + u8 id = 0; indio_dev = iio_allocate_device(sizeof(*chip)); if (!indio_dev) @@ -709,15 +709,17 @@ static int __devinit tsl2563_probe(struct i2c_client *client, chip->client = client; err = tsl2563_detect(chip); - if (err) { + if (err < 0) { dev_err(&client->dev, "device not found, error %d\n", -err); goto fail1; } err = tsl2563_read_id(chip, &id); - if (err) + if (err < 0) { + dev_err(&client->dev, "id reading failed, error %d\n", -err); goto fail1; - + } + id = err; mutex_init(&chip->lock); /* Default values used until userspace says otherwise */ _______________________________________________ devel mailing list devel@xxxxxxxxxxxxxxxxxxxxxx http://driverdev.linuxdriverproject.org/mailman/listinfo/devel