Unverified Commit 4cb01698 authored by openeuler-ci-bot's avatar openeuler-ci-bot Committed by Gitee
Browse files

!10761 leds: an30259a: Use devm_mutex_init() for mutex initialization

parents 1cf0467b 8e9a34ac
Loading
Loading
Loading
Loading
+4 −12
Original line number Diff line number Diff line
@@ -296,7 +296,10 @@ static int an30259a_probe(struct i2c_client *client)
	if (err < 0)
		return err;

	mutex_init(&chip->mutex);
	err = devm_mutex_init(&client->dev, &chip->mutex);
	if (err)
		return err;

	chip->client = client;
	i2c_set_clientdata(client, chip);

@@ -330,19 +333,9 @@ static int an30259a_probe(struct i2c_client *client)
	return 0;

exit:
	mutex_destroy(&chip->mutex);
	return err;
}

static int an30259a_remove(struct i2c_client *client)
{
	struct an30259a *chip = i2c_get_clientdata(client);

	mutex_destroy(&chip->mutex);

	return 0;
}

static const struct of_device_id an30259a_match_table[] = {
	{ .compatible = "panasonic,an30259a", },
	{ /* sentinel */ },
@@ -362,7 +355,6 @@ static struct i2c_driver an30259a_driver = {
		.of_match_table = of_match_ptr(an30259a_match_table),
	},
	.probe_new = an30259a_probe,
	.remove = an30259a_remove,
	.id_table = an30259a_id,
};