iio: tsl4531: fix error handling in tsl4531_check_id()
[deliverable/linux.git] / drivers / iio / light / tsl4531.c
index 63c26e2d5d9722242cf82b0bc8c5dc3ec3eacd46..cf94ec72b181fb756e32502b5c83059c1f9388b4 100644 (file)
@@ -158,9 +158,9 @@ static int tsl4531_check_id(struct i2c_client *client)
        case TSL45313_ID:
        case TSL45315_ID:
        case TSL45317_ID:
-               return 1;
-       default:
                return 0;
+       default:
+               return -ENODEV;
        }
 }
 
@@ -180,9 +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) {
                dev_err(&client->dev, "no TSL4531 sensor\n");
-               return -ENODEV;
+               return ret;
        }
 
        ret = i2c_smbus_write_byte_data(data->client, TSL4531_CONTROL,
@@ -247,7 +248,6 @@ static struct i2c_driver tsl4531_driver = {
        .driver = {
                .name   = TSL4531_DRV_NAME,
                .pm     = TSL4531_PM_OPS,
-               .owner  = THIS_MODULE,
        },
        .probe  = tsl4531_probe,
        .remove = tsl4531_remove,
This page took 0.028357 seconds and 5 git commands to generate.