1
1
// SPDX-License-Identifier: GPL-2.0-only
2
2
// Copyright (c) 2018-2020, The Linux Foundation. All rights reserved.
3
3
4
+ #include <linux/cleanup.h>
4
5
#include <linux/module.h>
5
6
#include <linux/init.h>
6
7
#include <linux/io.h>
@@ -3764,7 +3765,6 @@ static const struct snd_soc_component_driver rx_macro_component_drv = {
3764
3765
3765
3766
static int rx_macro_probe (struct platform_device * pdev )
3766
3767
{
3767
- struct reg_default * reg_defaults ;
3768
3768
struct device * dev = & pdev -> dev ;
3769
3769
kernel_ulong_t flags ;
3770
3770
struct rx_macro * rx ;
@@ -3812,6 +3812,8 @@ static int rx_macro_probe(struct platform_device *pdev)
3812
3812
return PTR_ERR (base );
3813
3813
3814
3814
rx -> codec_version = lpass_macro_get_codec_version ();
3815
+ struct reg_default * reg_defaults __free (kfree ) = NULL ;
3816
+
3815
3817
switch (rx -> codec_version ) {
3816
3818
case LPASS_CODEC_VERSION_1_0 :
3817
3819
case LPASS_CODEC_VERSION_1_1 :
@@ -3849,10 +3851,8 @@ static int rx_macro_probe(struct platform_device *pdev)
3849
3851
rx_regmap_config .num_reg_defaults = def_count ;
3850
3852
3851
3853
rx -> regmap = devm_regmap_init_mmio (dev , base , & rx_regmap_config );
3852
- if (IS_ERR (rx -> regmap )) {
3853
- ret = PTR_ERR (rx -> regmap );
3854
- goto err_ver ;
3855
- }
3854
+ if (IS_ERR (rx -> regmap ))
3855
+ return PTR_ERR (rx -> regmap );
3856
3856
3857
3857
dev_set_drvdata (dev , rx );
3858
3858
@@ -3864,7 +3864,7 @@ static int rx_macro_probe(struct platform_device *pdev)
3864
3864
3865
3865
ret = clk_prepare_enable (rx -> macro );
3866
3866
if (ret )
3867
- goto err_ver ;
3867
+ return ret ;
3868
3868
3869
3869
ret = clk_prepare_enable (rx -> dcodec );
3870
3870
if (ret )
@@ -3910,7 +3910,6 @@ static int rx_macro_probe(struct platform_device *pdev)
3910
3910
if (ret )
3911
3911
goto err_clkout ;
3912
3912
3913
- kfree (reg_defaults );
3914
3913
return 0 ;
3915
3914
3916
3915
err_clkout :
@@ -3923,8 +3922,6 @@ static int rx_macro_probe(struct platform_device *pdev)
3923
3922
clk_disable_unprepare (rx -> dcodec );
3924
3923
err_dcodec :
3925
3924
clk_disable_unprepare (rx -> macro );
3926
- err_ver :
3927
- kfree (reg_defaults );
3928
3925
3929
3926
return ret ;
3930
3927
}
0 commit comments