On Mon, 17 Aug 2015, Dan Carpenter wrote: > tsl4531_check_id() returns 1 on "found", 0 on "not found" and negative > if there is an error. The bug here is that the error handling, treats > errors as "found". > > Signed-off-by: Dan Carpenter <dan.carpenter@xxxxxxxxxx> Acked-by: Peter Meerwald <pmeerw@xxxxxxxxxx> > --- > v2: slightly different fix > > diff --git a/drivers/iio/light/tsl4531.c b/drivers/iio/light/tsl4531.c > index 2697918..fca0cb0 100644 > --- a/drivers/iio/light/tsl4531.c > +++ b/drivers/iio/light/tsl4531.c > @@ -180,7 +180,10 @@ static int tsl4531_probe(struct i2c_client *client, > data->client = client; > mutex_init(&data->lock); > > - if (!tsl4531_check_id(client)) { > + ret = tsl4531_check_id(client); > + if (ret < 0) > + return ret; > + if (ret == 0) { > dev_err(&client->dev, "no TSL4531 sensor\n"); > return -ENODEV; > } > -- Peter Meerwald +43-664-2444418 (mobile) -- To unsubscribe from this list: send the line "unsubscribe linux-iio" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html