summaryrefslogtreecommitdiff
path: root/sound/soc/codecs/max9877.c
diff options
context:
space:
mode:
authorLars-Peter Clausen <lars@metafoo.de>2015-07-16 19:22:49 (GMT)
committerMark Brown <broonie@kernel.org>2015-07-16 20:35:12 (GMT)
commitdf2e268226e2e3d79980a5dddfd683126f79ddb4 (patch)
treeb99b8de75e766e5a7e0776a18695d3892fc85cae /sound/soc/codecs/max9877.c
parent7d9fb377a747025232fe4e8d17e54ff8032aba27 (diff)
downloadlinux-df2e268226e2e3d79980a5dddfd683126f79ddb4.tar.xz
ASoC: max9877: Make driver global regmap struct local
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>
Diffstat (limited to 'sound/soc/codecs/max9877.c')
-rw-r--r--sound/soc/codecs/max9877.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/sound/soc/codecs/max9877.c b/sound/soc/codecs/max9877.c
index e1df06f..b469e1c 100644
--- a/sound/soc/codecs/max9877.c
+++ b/sound/soc/codecs/max9877.c
@@ -20,8 +20,6 @@
#include "max9877.h"
-static struct regmap *regmap;
-
static const struct reg_default max9877_regs[] = {
{ 0, 0x40 },
{ 1, 0x00 },
@@ -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);