|
5 | 5 | #include <linux/module.h>
|
6 | 6 | #include <linux/init.h>
|
7 | 7 | #include <linux/platform_device.h>
|
| 8 | +#include <linux/cleanup.h> |
8 | 9 | #include <linux/device.h>
|
9 | 10 | #include <linux/wait.h>
|
10 | 11 | #include <linux/bitops.h>
|
@@ -2714,42 +2715,38 @@ static int wcd9335_codec_enable_dec(struct snd_soc_dapm_widget *w,
|
2714 | 2715 | struct snd_soc_component *comp = snd_soc_dapm_to_component(w->dapm);
|
2715 | 2716 | unsigned int decimator;
|
2716 | 2717 | char *dec_adc_mux_name = NULL;
|
2717 |
| - char *widget_name = NULL; |
2718 |
| - char *wname; |
| 2718 | + char *widget_name; |
2719 | 2719 | int ret = 0, amic_n;
|
2720 | 2720 | u16 tx_vol_ctl_reg, pwr_level_reg = 0, dec_cfg_reg, hpf_gate_reg;
|
2721 | 2721 | u16 tx_gain_ctl_reg;
|
2722 | 2722 | char *dec;
|
2723 | 2723 | u8 hpf_coff_freq;
|
2724 | 2724 |
|
2725 |
| - widget_name = kmemdup_nul(w->name, 15, GFP_KERNEL); |
2726 |
| - if (!widget_name) |
| 2725 | + char *wname __free(kfree) = kmemdup_nul(w->name, 15, GFP_KERNEL); |
| 2726 | + if (!wname) |
2727 | 2727 | return -ENOMEM;
|
2728 | 2728 |
|
2729 |
| - wname = widget_name; |
| 2729 | + widget_name = wname; |
2730 | 2730 | dec_adc_mux_name = strsep(&widget_name, " ");
|
2731 | 2731 | if (!dec_adc_mux_name) {
|
2732 | 2732 | dev_err(comp->dev, "%s: Invalid decimator = %s\n",
|
2733 | 2733 | __func__, w->name);
|
2734 |
| - ret = -EINVAL; |
2735 |
| - goto out; |
| 2734 | + return -EINVAL; |
2736 | 2735 | }
|
2737 | 2736 | dec_adc_mux_name = widget_name;
|
2738 | 2737 |
|
2739 | 2738 | dec = strpbrk(dec_adc_mux_name, "012345678");
|
2740 | 2739 | if (!dec) {
|
2741 | 2740 | dev_err(comp->dev, "%s: decimator index not found\n",
|
2742 | 2741 | __func__);
|
2743 |
| - ret = -EINVAL; |
2744 |
| - goto out; |
| 2742 | + return -EINVAL; |
2745 | 2743 | }
|
2746 | 2744 |
|
2747 | 2745 | ret = kstrtouint(dec, 10, &decimator);
|
2748 | 2746 | if (ret < 0) {
|
2749 | 2747 | dev_err(comp->dev, "%s: Invalid decimator = %s\n",
|
2750 | 2748 | __func__, wname);
|
2751 |
| - ret = -EINVAL; |
2752 |
| - goto out; |
| 2749 | + return -EINVAL; |
2753 | 2750 | }
|
2754 | 2751 |
|
2755 | 2752 | tx_vol_ctl_reg = WCD9335_CDC_TX0_TX_PATH_CTL + 16 * decimator;
|
@@ -2836,8 +2833,7 @@ static int wcd9335_codec_enable_dec(struct snd_soc_dapm_widget *w,
|
2836 | 2833 | snd_soc_component_update_bits(comp, tx_vol_ctl_reg, 0x10, 0x00);
|
2837 | 2834 | break;
|
2838 | 2835 | }
|
2839 |
| -out: |
2840 |
| - kfree(wname); |
| 2836 | + |
2841 | 2837 | return ret;
|
2842 | 2838 | }
|
2843 | 2839 |
|
|
0 commit comments