Skip to content

Commit

Permalink
ASoC: max9877: Make driver global regmap struct local
Browse files Browse the repository at this point in the history
Use a stack local variable to handle function local state rather than a
global static variable. The later has a potential for race conditions if
the probe function runs for two devices concurrently.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Mark Brown <broonie@kernel.org>
  • Loading branch information
Lars-Peter Clausen authored and Mark Brown committed Jul 16, 2015
1 parent 7d9fb37 commit df2e268
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions sound/soc/codecs/max9877.c
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@

#include "max9877.h"

static struct regmap *regmap;

static const struct reg_default max9877_regs[] = {
{ 0, 0x40 },
{ 1, 0x00 },
Expand Down Expand Up @@ -145,6 +143,7 @@ static const struct regmap_config max9877_regmap = {
static int max9877_i2c_probe(struct i2c_client *client,
const struct i2c_device_id *id)
{
struct regmap *regmap;
int i;

regmap = devm_regmap_init_i2c(client, &max9877_regmap);
Expand Down

0 comments on commit df2e268

Please sign in to comment.