]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
ASoC: max9877: Make driver global regmap struct local
authorLars-Peter Clausen <lars@metafoo.de>
Thu, 16 Jul 2015 19:22:49 +0000 (21:22 +0200)
committerMark Brown <broonie@kernel.org>
Thu, 16 Jul 2015 20:35:12 +0000 (21:35 +0100)
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>
sound/soc/codecs/max9877.c

index e1df06fab75645db8da0735f1a12a54cb4fb0383..b469e1c82ea2e5f9996952499c0bdb9d84714f19 100644 (file)
@@ -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);