[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-Id: <20251129-asoc-wrong-cleanup-h-can-people-stop-sending-this-without-reading-docs-v1-6-c38b06884e39@oss.qualcomm.com>
Date: Sat, 29 Nov 2025 14:17:58 +0100
From: Krzysztof Kozlowski <krzysztof.kozlowski@....qualcomm.com>
To: Srinivas Kandagatla <srini@...nel.org>,
Liam Girdwood <lgirdwood@...il.com>, Mark Brown <broonie@...nel.org>,
Jaroslav Kysela <perex@...ex.cz>, Takashi Iwai <tiwai@...e.com>
Cc: linux-sound@...r.kernel.org, linux-arm-msm@...r.kernel.org,
linux-kernel@...r.kernel.org,
Krzysztof Kozlowski <krzysztof.kozlowski@....qualcomm.com>
Subject: [PATCH 6/6] ASoC: qcom: Minor readability improve with new lines
Variables with automatic cleanup are special because they do not follow
standard rules of declaration at top of function (see cleanup.h), but on
the other hand we always expect line break between top-function
declarations and first instructions.
Don't pretend automatic cleanup variables are part of top-level
declaration to improve readability when variable is followed by nun-NULL
check. No functional impact, only style.
Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@....qualcomm.com>
---
sound/soc/qcom/qdsp6/audioreach.c | 8 +++++++-
sound/soc/qcom/qdsp6/q6adm.c | 2 ++
sound/soc/qcom/qdsp6/q6afe.c | 4 ++++
sound/soc/qcom/qdsp6/q6apm.c | 3 +++
sound/soc/qcom/qdsp6/q6asm.c | 13 +++++++++++++
5 files changed, 29 insertions(+), 1 deletion(-)
diff --git a/sound/soc/qcom/qdsp6/audioreach.c b/sound/soc/qcom/qdsp6/audioreach.c
index 329d916779f0..f3fa0a5b4095 100644
--- a/sound/soc/qcom/qdsp6/audioreach.c
+++ b/sound/soc/qcom/qdsp6/audioreach.c
@@ -617,6 +617,7 @@ static int audioreach_display_port_set_media_format(struct q6apm_graph *graph,
int fs_sz = APM_FS_CFG_PSIZE;
int size = ic_sz + ep_sz + fs_sz;
void *p;
+
struct gpr_pkt *pkt __free(kfree) = audioreach_alloc_apm_cmd_pkt(size, APM_CMD_SET_CFG, 0);
if (IS_ERR(pkt))
return PTR_ERR(pkt);
@@ -675,6 +676,7 @@ static int audioreach_codec_dma_set_media_format(struct q6apm_graph *graph,
int pm_sz = APM_HW_EP_PMODE_CFG_PSIZE;
int size = ic_sz + ep_sz + fs_sz + pm_sz;
void *p;
+
struct gpr_pkt *pkt __free(kfree) = audioreach_alloc_apm_cmd_pkt(size, APM_CMD_SET_CFG, 0);
if (IS_ERR(pkt))
return PTR_ERR(pkt);
@@ -788,6 +790,7 @@ static int audioreach_set_module_config(struct q6apm_graph *graph,
{
int size = le32_to_cpu(module->data->size);
void *p;
+
struct gpr_pkt *pkt __free(kfree) = audioreach_alloc_apm_cmd_pkt(size, APM_CMD_SET_CFG, 0);
if (IS_ERR(pkt))
return PTR_ERR(pkt);
@@ -810,6 +813,7 @@ static int audioreach_mfc_set_media_format(struct q6apm_graph *graph,
APM_MODULE_PARAM_DATA_SIZE;
int i;
void *p;
+
struct gpr_pkt *pkt __free(kfree) = audioreach_alloc_apm_cmd_pkt(payload_size, APM_CMD_SET_CFG, 0);
if (IS_ERR(pkt))
return PTR_ERR(pkt);
@@ -922,13 +926,13 @@ int audioreach_compr_set_param(struct q6apm_graph *graph, struct audioreach_modu
void *p;
int iid = q6apm_graph_get_rx_shmem_module_iid(graph);
int payload_size = sizeof(struct apm_sh_module_media_fmt_cmd);
+
struct gpr_pkt *pkt __free(kfree) = audioreach_alloc_cmd_pkt(payload_size,
DATA_CMD_WR_SH_MEM_EP_MEDIA_FORMAT,
0, graph->port->id, iid);
if (IS_ERR(pkt))
return -ENOMEM;
-
p = (void *)pkt + GPR_HDR_SIZE;
header = p;
rc = audioreach_set_compr_media_format(header, p, mcfg);
@@ -952,6 +956,7 @@ static int audioreach_i2s_set_media_format(struct q6apm_graph *graph,
int fs_sz = APM_FS_CFG_PSIZE;
int size = ic_sz + ep_sz + fs_sz;
void *p;
+
struct gpr_pkt *pkt __free(kfree) = audioreach_alloc_apm_cmd_pkt(size, APM_CMD_SET_CFG, 0);
if (IS_ERR(pkt))
return PTR_ERR(pkt);
@@ -1013,6 +1018,7 @@ static int audioreach_logging_set_media_format(struct q6apm_graph *graph,
struct data_logging_config *cfg;
int size = sizeof(*cfg) + APM_MODULE_PARAM_DATA_SIZE;
void *p;
+
struct gpr_pkt *pkt __free(kfree) = audioreach_alloc_apm_cmd_pkt(size, APM_CMD_SET_CFG, 0);
if (IS_ERR(pkt))
return PTR_ERR(pkt);
diff --git a/sound/soc/qcom/qdsp6/q6adm.c b/sound/soc/qcom/qdsp6/q6adm.c
index 0b8d06ec8b26..bbe986293ec3 100644
--- a/sound/soc/qcom/qdsp6/q6adm.c
+++ b/sound/soc/qcom/qdsp6/q6adm.c
@@ -331,6 +331,7 @@ static int q6adm_device_open(struct q6adm *adm, struct q6copp *copp,
int afe_port = q6afe_get_port_id(port_id);
struct apr_pkt *pkt;
int ret, pkt_size = APR_HDR_SIZE + sizeof(*open);
+
void *p __free(kfree) = kzalloc(pkt_size, GFP_KERNEL);
if (!p)
return -ENOMEM;
@@ -466,6 +467,7 @@ int q6adm_matrix_map(struct device *dev, int path,
struct q6copp *copp;
int pkt_size = (APR_HDR_SIZE + sizeof(*route) + sizeof(*node) +
(sizeof(uint32_t) * payload_map.num_copps));
+
void *matrix_map __free(kfree) = kzalloc(pkt_size, GFP_KERNEL);
if (!matrix_map)
return -ENOMEM;
diff --git a/sound/soc/qcom/qdsp6/q6afe.c b/sound/soc/qcom/qdsp6/q6afe.c
index c9fdd53492e0..0cf6aebe498c 100644
--- a/sound/soc/qcom/qdsp6/q6afe.c
+++ b/sound/soc/qcom/qdsp6/q6afe.c
@@ -1077,6 +1077,7 @@ static int q6afe_set_param(struct q6afe *afe, struct q6afe_port *port,
struct apr_pkt *pkt;
int ret, pkt_size = APR_HDR_SIZE + sizeof(*param) + sizeof(*pdata) + psize;
void *pl;
+
void *p __free(kfree) = kzalloc(pkt_size, GFP_KERNEL);
if (!p)
return -ENOMEM;
@@ -1128,6 +1129,7 @@ static int q6afe_port_set_param_v2(struct q6afe_port *port, void *data,
u16 port_id = port->id;
int ret, pkt_size = APR_HDR_SIZE + sizeof(*param) + sizeof(*pdata) + psize;
void *pl;
+
void *p __free(kfree) = kzalloc(pkt_size, GFP_KERNEL);
if (!p)
return -ENOMEM;
@@ -1832,6 +1834,7 @@ int q6afe_unvote_lpass_core_hw(struct device *dev, uint32_t hw_block_id,
struct apr_pkt *pkt;
int ret = 0;
int pkt_size = APR_HDR_SIZE + sizeof(*vote_cfg);
+
void *p __free(kfree) = kzalloc(pkt_size, GFP_KERNEL);
if (!p)
return -ENOMEM;
@@ -1866,6 +1869,7 @@ int q6afe_vote_lpass_core_hw(struct device *dev, uint32_t hw_block_id,
struct apr_pkt *pkt;
int ret = 0;
int pkt_size = APR_HDR_SIZE + sizeof(*vote_cfg);
+
void *p __free(kfree) = kzalloc(pkt_size, GFP_KERNEL);
if (!p)
return -ENOMEM;
diff --git a/sound/soc/qcom/qdsp6/q6apm.c b/sound/soc/qcom/qdsp6/q6apm.c
index 4e5ad04ece50..e30f8648ae15 100644
--- a/sound/soc/qcom/qdsp6/q6apm.c
+++ b/sound/soc/qcom/qdsp6/q6apm.c
@@ -100,6 +100,7 @@ static int audioreach_graph_mgmt_cmd(struct audioreach_graph *graph, uint32_t op
struct audioreach_sub_graph *sg;
struct q6apm *apm = graph->apm;
int i = 0, payload_size = APM_GRAPH_MGMT_PSIZE(mgmt_cmd, num_sub_graphs);
+
struct gpr_pkt *pkt __free(kfree) = audioreach_alloc_apm_cmd_pkt(payload_size, opcode, 0);
if (IS_ERR(pkt))
return PTR_ERR(pkt);
@@ -409,6 +410,7 @@ int q6apm_write_async(struct q6apm_graph *graph, uint32_t len, uint32_t msw_ts,
struct apm_data_cmd_wr_sh_mem_ep_data_buffer_v2 *write_buffer;
struct audio_buffer *ab;
int iid = q6apm_graph_get_rx_shmem_module_iid(graph);
+
struct gpr_pkt *pkt __free(kfree) = audioreach_alloc_pkt(sizeof(*write_buffer),
DATA_CMD_WR_SH_MEM_EP_DATA_BUFFER_V2,
graph->rx_data.dsp_buf | (len << APM_WRITE_TOKEN_LEN_SHIFT),
@@ -446,6 +448,7 @@ int q6apm_read(struct q6apm_graph *graph)
struct audioreach_graph_data *port;
struct audio_buffer *ab;
int iid = q6apm_graph_get_tx_shmem_module_iid(graph);
+
struct gpr_pkt *pkt __free(kfree) = audioreach_alloc_pkt(sizeof(*read_buffer),
DATA_CMD_RD_SH_MEM_EP_DATA_BUFFER_V2,
graph->tx_data.dsp_buf, graph->port->id, iid);
diff --git a/sound/soc/qcom/qdsp6/q6asm.c b/sound/soc/qcom/qdsp6/q6asm.c
index 890a1f786627..420176f80ffe 100644
--- a/sound/soc/qcom/qdsp6/q6asm.c
+++ b/sound/soc/qcom/qdsp6/q6asm.c
@@ -928,6 +928,7 @@ int q6asm_open_write(struct audio_client *ac, uint32_t stream_id,
struct asm_stream_cmd_open_write_v3 *open;
struct apr_pkt *pkt;
int rc, pkt_size = APR_HDR_SIZE + sizeof(*open);
+
void *p __free(kfree) = kzalloc(pkt_size, GFP_KERNEL);
if (!p)
return -ENOMEM;
@@ -1005,6 +1006,7 @@ static int __q6asm_run(struct audio_client *ac, uint32_t stream_id,
struct asm_session_cmd_run_v2 *run;
struct apr_pkt *pkt;
int rc, pkt_size = APR_HDR_SIZE + sizeof(*run);
+
void *p __free(kfree) = kzalloc(pkt_size, GFP_ATOMIC);
if (!p)
return -ENOMEM;
@@ -1087,6 +1089,7 @@ int q6asm_media_format_block_multi_ch_pcm(struct audio_client *ac,
struct apr_pkt *pkt;
u8 *channel_mapping;
int pkt_size = APR_HDR_SIZE + sizeof(*fmt);
+
void *p __free(kfree) = kzalloc(pkt_size, GFP_KERNEL);
if (!p)
return -ENOMEM;
@@ -1125,6 +1128,7 @@ int q6asm_stream_media_format_block_flac(struct audio_client *ac,
struct asm_flac_fmt_blk_v2 *fmt;
struct apr_pkt *pkt;
int pkt_size = APR_HDR_SIZE + sizeof(*fmt);
+
void *p __free(kfree) = kzalloc(pkt_size, GFP_KERNEL);
if (!p)
return -ENOMEM;
@@ -1156,6 +1160,7 @@ int q6asm_stream_media_format_block_wma_v9(struct audio_client *ac,
struct asm_wmastdv9_fmt_blk_v2 *fmt;
struct apr_pkt *pkt;
int pkt_size = APR_HDR_SIZE + sizeof(*fmt);
+
void *p __free(kfree) = kzalloc(pkt_size, GFP_KERNEL);
if (!p)
return -ENOMEM;
@@ -1188,6 +1193,7 @@ int q6asm_stream_media_format_block_wma_v10(struct audio_client *ac,
struct asm_wmaprov10_fmt_blk_v2 *fmt;
struct apr_pkt *pkt;
int pkt_size = APR_HDR_SIZE + sizeof(*fmt);
+
void *p __free(kfree) = kzalloc(pkt_size, GFP_KERNEL);
if (!p)
return -ENOMEM;
@@ -1221,6 +1227,7 @@ int q6asm_stream_media_format_block_alac(struct audio_client *ac,
struct asm_alac_fmt_blk_v2 *fmt;
struct apr_pkt *pkt;
int pkt_size = APR_HDR_SIZE + sizeof(*fmt);
+
void *p __free(kfree) = kzalloc(pkt_size, GFP_KERNEL);
if (!p)
return -ENOMEM;
@@ -1257,6 +1264,7 @@ int q6asm_stream_media_format_block_ape(struct audio_client *ac,
struct asm_ape_fmt_blk_v2 *fmt;
struct apr_pkt *pkt;
int pkt_size = APR_HDR_SIZE + sizeof(*fmt);
+
void *p __free(kfree) = kzalloc(pkt_size, GFP_KERNEL);
if (!p)
return -ENOMEM;
@@ -1291,6 +1299,7 @@ static int q6asm_stream_remove_silence(struct audio_client *ac, uint32_t stream_
uint32_t *samples;
struct apr_pkt *pkt;
int rc, pkt_size = APR_HDR_SIZE + sizeof(uint32_t);
+
void *p __free(kfree) = kzalloc(pkt_size, GFP_ATOMIC);
if (!p)
return -ENOMEM;
@@ -1349,6 +1358,7 @@ int q6asm_enc_cfg_blk_pcm_format_support(struct audio_client *ac,
u8 *channel_mapping;
u32 frames_per_buf = 0;
int pkt_size = APR_HDR_SIZE + sizeof(*enc_cfg);
+
void *p __free(kfree) = kzalloc(pkt_size, GFP_KERNEL);
if (!p)
return -ENOMEM;
@@ -1395,6 +1405,7 @@ int q6asm_read(struct audio_client *ac, uint32_t stream_id)
unsigned long flags;
int pkt_size = APR_HDR_SIZE + sizeof(*read);
int rc = 0;
+
void *p __free(kfree) = kzalloc(pkt_size, GFP_ATOMIC);
if (!p)
return -ENOMEM;
@@ -1437,6 +1448,7 @@ static int __q6asm_open_read(struct audio_client *ac, uint32_t stream_id,
struct asm_stream_cmd_open_read_v3 *open;
struct apr_pkt *pkt;
int pkt_size = APR_HDR_SIZE + sizeof(*open);
+
void *p __free(kfree) = kzalloc(pkt_size, GFP_KERNEL);
if (!p)
return -ENOMEM;
@@ -1507,6 +1519,7 @@ int q6asm_write_async(struct audio_client *ac, uint32_t stream_id, uint32_t len,
struct apr_pkt *pkt;
int pkt_size = APR_HDR_SIZE + sizeof(*write);
int rc = 0;
+
void *p __free(kfree) = kzalloc(pkt_size, GFP_ATOMIC);
if (!p)
return -ENOMEM;
--
2.48.1
Powered by blists - more mailing lists