@@ -556,6 +556,10 @@ static int ktd202x_probe(struct i2c_client *client)
return ret;
}
+ ret = devm_mutex_init(dev, &chip->mutex);
+ if (ret)
+ return ret;
+
chip->num_leds = (unsigned long)i2c_get_match_data(client);
chip->regulators[0].supply = "vin";
@@ -584,8 +588,6 @@ static int ktd202x_probe(struct i2c_client *client)
return ret;
}
- mutex_init(&chip->mutex);
-
return 0;
}
@@ -594,8 +596,6 @@ static void ktd202x_remove(struct i2c_client *client)
struct ktd202x *chip = i2c_get_clientdata(client);
ktd202x_chip_disable(chip);
-
- mutex_destroy(&chip->mutex);
}
static void ktd202x_shutdown(struct i2c_client *client)