soundwire: intel_ace2x: simplify with cleanup.h
Allocate the memory with scoped/cleanup.h to reduce error handling and make the code a bit simpler. Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org> Link: https://lore.kernel.org/r/20240703-soundwire-cleanup-h-v1-7-24fa0dbb948f@linaro.org Signed-off-by: Vinod Koul <vkoul@kernel.org>
This commit is contained in:
parent
13814ed162
commit
3dce65898e
@ -6,6 +6,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include <linux/acpi.h>
|
#include <linux/acpi.h>
|
||||||
|
#include <linux/cleanup.h>
|
||||||
#include <linux/device.h>
|
#include <linux/device.h>
|
||||||
#include <linux/soundwire/sdw_registers.h>
|
#include <linux/soundwire/sdw_registers.h>
|
||||||
#include <linux/soundwire/sdw.h>
|
#include <linux/soundwire/sdw.h>
|
||||||
@ -310,7 +311,6 @@ static int intel_hw_params(struct snd_pcm_substream *substream,
|
|||||||
struct sdw_cdns_dai_runtime *dai_runtime;
|
struct sdw_cdns_dai_runtime *dai_runtime;
|
||||||
struct sdw_cdns_pdi *pdi;
|
struct sdw_cdns_pdi *pdi;
|
||||||
struct sdw_stream_config sconfig;
|
struct sdw_stream_config sconfig;
|
||||||
struct sdw_port_config *pconfig;
|
|
||||||
int ch, dir;
|
int ch, dir;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
@ -357,7 +357,8 @@ static int intel_hw_params(struct snd_pcm_substream *substream,
|
|||||||
sconfig.bps = snd_pcm_format_width(params_format(params));
|
sconfig.bps = snd_pcm_format_width(params_format(params));
|
||||||
|
|
||||||
/* Port configuration */
|
/* Port configuration */
|
||||||
pconfig = kzalloc(sizeof(*pconfig), GFP_KERNEL);
|
struct sdw_port_config *pconfig __free(kfree) = kzalloc(sizeof(*pconfig),
|
||||||
|
GFP_KERNEL);
|
||||||
if (!pconfig)
|
if (!pconfig)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
|
|
||||||
@ -369,8 +370,6 @@ static int intel_hw_params(struct snd_pcm_substream *substream,
|
|||||||
if (ret)
|
if (ret)
|
||||||
dev_err(cdns->dev, "add master to stream failed:%d\n", ret);
|
dev_err(cdns->dev, "add master to stream failed:%d\n", ret);
|
||||||
|
|
||||||
kfree(pconfig);
|
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user