struct wm8753_priv *wm8753;
int ret;
- wm8753 = kzalloc(sizeof(struct wm8753_priv), GFP_KERNEL);
+ wm8753 = devm_kzalloc(&spi->dev, sizeof(struct wm8753_priv),
+ GFP_KERNEL);
if (wm8753 == NULL)
return -ENOMEM;
err_regmap:
regmap_exit(wm8753->regmap);
err:
- kfree(wm8753);
return ret;
}
struct wm8753_priv *wm8753;
int ret;
- wm8753 = kzalloc(sizeof(struct wm8753_priv), GFP_KERNEL);
+ wm8753 = devm_kzalloc(&i2c->dev, sizeof(struct wm8753_priv),
+ GFP_KERNEL);
if (wm8753 == NULL)
return -ENOMEM;
dev_err(&i2c->dev, "Failed to register CODEC: %d\n", ret);
goto err_regmap;
}
+
err_regmap:
regmap_exit(wm8753->regmap);
err:
- kfree(wm8753);
return ret;
}
snd_soc_unregister_codec(&client->dev);
regmap_exit(wm8753->regmap);
- kfree(wm8753);
return 0;
}