summaryrefslogtreecommitdiff
path: root/drivers/soundwire
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/soundwire')
-rw-r--r--drivers/soundwire/amd_init.c10
-rw-r--r--drivers/soundwire/amd_manager.c6
-rw-r--r--drivers/soundwire/cadence_master.c2
-rw-r--r--drivers/soundwire/debugfs.c2
-rw-r--r--drivers/soundwire/generic_bandwidth_allocation.c2
-rw-r--r--drivers/soundwire/intel.c4
-rw-r--r--drivers/soundwire/intel_ace2x.c6
-rw-r--r--drivers/soundwire/intel_init.c10
-rw-r--r--drivers/soundwire/master.c2
-rw-r--r--drivers/soundwire/qcom.c5
-rw-r--r--drivers/soundwire/slave.c2
-rw-r--r--drivers/soundwire/stream.c12
12 files changed, 32 insertions, 31 deletions
diff --git a/drivers/soundwire/amd_init.c b/drivers/soundwire/amd_init.c
index 643e94524fe6..e71cc23523e1 100644
--- a/drivers/soundwire/amd_init.c
+++ b/drivers/soundwire/amd_init.c
@@ -98,14 +98,14 @@ static struct sdw_amd_ctx *sdw_amd_probe_controller(struct sdw_amd_res *res)
* the parent .probe.
* If devm_ was used, the memory might never be freed on errors.
*/
- ctx = kzalloc(sizeof(*ctx), GFP_KERNEL);
+ ctx = kzalloc_obj(*ctx, GFP_KERNEL);
if (!ctx)
return NULL;
ctx->count = count;
ctx->link_mask = res->link_mask;
- struct resource *sdw_res __free(kfree) = kzalloc(sizeof(*sdw_res),
- GFP_KERNEL);
+ struct resource *sdw_res __free(kfree) = kzalloc_obj(*sdw_res,
+ GFP_KERNEL);
if (!sdw_res) {
kfree(ctx);
return NULL;
@@ -205,8 +205,8 @@ int sdw_amd_get_slave_info(struct sdw_amd_ctx *ctx)
num_slaves++;
}
- ctx->peripherals = kmalloc(struct_size(ctx->peripherals, array, num_slaves),
- GFP_KERNEL);
+ ctx->peripherals = kmalloc_flex(*ctx->peripherals, array, num_slaves,
+ GFP_KERNEL);
if (!ctx->peripherals)
return -ENOMEM;
ctx->peripherals->num_peripherals = num_slaves;
diff --git a/drivers/soundwire/amd_manager.c b/drivers/soundwire/amd_manager.c
index 5fd311ee4107..91dee9499df2 100644
--- a/drivers/soundwire/amd_manager.c
+++ b/drivers/soundwire/amd_manager.c
@@ -718,8 +718,8 @@ static int amd_sdw_hw_params(struct snd_pcm_substream *substream,
sconfig.bps = snd_pcm_format_width(params_format(params));
/* Port configuration */
- struct sdw_port_config *pconfig __free(kfree) = kzalloc(sizeof(*pconfig),
- GFP_KERNEL);
+ struct sdw_port_config *pconfig __free(kfree) = kzalloc_obj(*pconfig,
+ GFP_KERNEL);
if (!pconfig)
return -ENOMEM;
@@ -764,7 +764,7 @@ static int amd_set_sdw_stream(struct snd_soc_dai *dai, void *stream, int directi
}
/* allocate and set dai_runtime info */
- dai_runtime = kzalloc(sizeof(*dai_runtime), GFP_KERNEL);
+ dai_runtime = kzalloc_obj(*dai_runtime, GFP_KERNEL);
if (!dai_runtime)
return -ENOMEM;
diff --git a/drivers/soundwire/cadence_master.c b/drivers/soundwire/cadence_master.c
index a106e5e482c8..dfdb591c6f6e 100644
--- a/drivers/soundwire/cadence_master.c
+++ b/drivers/soundwire/cadence_master.c
@@ -1846,7 +1846,7 @@ int cdns_set_sdw_stream(struct snd_soc_dai *dai,
}
/* allocate and set dai_runtime info */
- dai_runtime = kzalloc(sizeof(*dai_runtime), GFP_KERNEL);
+ dai_runtime = kzalloc_obj(*dai_runtime, GFP_KERNEL);
if (!dai_runtime)
return -ENOMEM;
diff --git a/drivers/soundwire/debugfs.c b/drivers/soundwire/debugfs.c
index 6068011dd0d9..0e9c48ca76e9 100644
--- a/drivers/soundwire/debugfs.c
+++ b/drivers/soundwire/debugfs.c
@@ -224,7 +224,7 @@ static int do_bpt_sequence(struct sdw_slave *slave, bool write, u8 *buffer)
struct sdw_bpt_msg msg = {0};
struct sdw_bpt_section *sec;
- sec = kcalloc(1, sizeof(*sec), GFP_KERNEL);
+ sec = kzalloc_objs(*sec, 1, GFP_KERNEL);
if (!sec)
return -ENOMEM;
msg.sections = 1;
diff --git a/drivers/soundwire/generic_bandwidth_allocation.c b/drivers/soundwire/generic_bandwidth_allocation.c
index 530ac66ac6fa..f5a7f404aacb 100644
--- a/drivers/soundwire/generic_bandwidth_allocation.c
+++ b/drivers/soundwire/generic_bandwidth_allocation.c
@@ -402,7 +402,7 @@ static int sdw_compute_port_params(struct sdw_bus *bus, struct sdw_stream_runtim
if (group.count == 0)
goto out;
- params = kcalloc(group.count, sizeof(*params), GFP_KERNEL);
+ params = kzalloc_objs(*params, group.count, GFP_KERNEL);
if (!params) {
ret = -ENOMEM;
goto out;
diff --git a/drivers/soundwire/intel.c b/drivers/soundwire/intel.c
index 9db78f3d7615..5b4d84ceecff 100644
--- a/drivers/soundwire/intel.c
+++ b/drivers/soundwire/intel.c
@@ -769,8 +769,8 @@ static int intel_hw_params(struct snd_pcm_substream *substream,
sconfig.bps = snd_pcm_format_width(params_format(params));
/* Port configuration */
- struct sdw_port_config *pconfig __free(kfree) = kzalloc(sizeof(*pconfig),
- GFP_KERNEL);
+ struct sdw_port_config *pconfig __free(kfree) = kzalloc_obj(*pconfig,
+ GFP_KERNEL);
if (!pconfig)
return -ENOMEM;
diff --git a/drivers/soundwire/intel_ace2x.c b/drivers/soundwire/intel_ace2x.c
index 1ed0251d2592..8a37d185cbca 100644
--- a/drivers/soundwire/intel_ace2x.c
+++ b/drivers/soundwire/intel_ace2x.c
@@ -127,7 +127,7 @@ static int intel_ace2x_bpt_open_stream(struct sdw_intel *sdw, struct sdw_slave *
sconfig.bps = 32; /* this is required for BPT/BRA */
/* Port configuration */
- pconfig = kcalloc(2, sizeof(*pconfig), GFP_KERNEL);
+ pconfig = kzalloc_objs(*pconfig, 2, GFP_KERNEL);
if (!pconfig) {
ret = -ENOMEM;
goto remove_slave;
@@ -747,8 +747,8 @@ static int intel_hw_params(struct snd_pcm_substream *substream,
sconfig.bps = snd_pcm_format_width(params_format(params));
/* Port configuration */
- struct sdw_port_config *pconfig __free(kfree) = kzalloc(sizeof(*pconfig),
- GFP_KERNEL);
+ struct sdw_port_config *pconfig __free(kfree) = kzalloc_obj(*pconfig,
+ GFP_KERNEL);
if (!pconfig)
return -ENOMEM;
diff --git a/drivers/soundwire/intel_init.c b/drivers/soundwire/intel_init.c
index 4ffdabaf9693..982d25f92c7c 100644
--- a/drivers/soundwire/intel_init.c
+++ b/drivers/soundwire/intel_init.c
@@ -40,7 +40,7 @@ static struct sdw_intel_link_dev *intel_link_dev_register(struct sdw_intel_res *
struct auxiliary_device *auxdev;
int ret;
- ldev = kzalloc(sizeof(*ldev), GFP_KERNEL);
+ ldev = kzalloc_obj(*ldev, GFP_KERNEL);
if (!ldev)
return ERR_PTR(-ENOMEM);
@@ -186,7 +186,7 @@ static struct sdw_intel_ctx
* the parent .probe.
* If devm_ was used, the memory might never be freed on errors.
*/
- ctx = kzalloc(sizeof(*ctx), GFP_KERNEL);
+ ctx = kzalloc_obj(*ctx, GFP_KERNEL);
if (!ctx)
return NULL;
@@ -198,7 +198,7 @@ static struct sdw_intel_ctx
* If some links are disabled, the link pointer will remain NULL. Given that the
* number of links is small, this is simpler than using a list to keep track of links.
*/
- ctx->ldev = kcalloc(ctx->count, sizeof(*ctx->ldev), GFP_KERNEL);
+ ctx->ldev = kzalloc_objs(*ctx->ldev, ctx->count, GFP_KERNEL);
if (!ctx->ldev) {
kfree(ctx);
return NULL;
@@ -253,8 +253,8 @@ static struct sdw_intel_ctx
num_slaves++;
}
- ctx->peripherals = kmalloc(struct_size(ctx->peripherals, array, num_slaves),
- GFP_KERNEL);
+ ctx->peripherals = kmalloc_flex(*ctx->peripherals, array, num_slaves,
+ GFP_KERNEL);
if (!ctx->peripherals)
goto err;
ctx->peripherals->num_peripherals = num_slaves;
diff --git a/drivers/soundwire/master.c b/drivers/soundwire/master.c
index b2c64512739d..a0f94877bc91 100644
--- a/drivers/soundwire/master.c
+++ b/drivers/soundwire/master.c
@@ -133,7 +133,7 @@ int sdw_master_device_add(struct sdw_bus *bus, struct device *parent,
if (!parent)
return -EINVAL;
- md = kzalloc(sizeof(*md), GFP_KERNEL);
+ md = kzalloc_obj(*md, GFP_KERNEL);
if (!md)
return -ENOMEM;
diff --git a/drivers/soundwire/qcom.c b/drivers/soundwire/qcom.c
index 8102a1b0d516..a85b9ecf1a05 100644
--- a/drivers/soundwire/qcom.c
+++ b/drivers/soundwire/qcom.c
@@ -1230,8 +1230,9 @@ static int qcom_swrm_stream_alloc_ports(struct qcom_swrm_ctrl *ctrl,
unsigned long *port_mask;
int maxport, pn, nports = 0;
unsigned int m_port;
- struct sdw_port_config *pconfig __free(kfree) = kcalloc(ctrl->nports,
- sizeof(*pconfig), GFP_KERNEL);
+ struct sdw_port_config *pconfig __free(kfree) = kzalloc_objs(*pconfig,
+ ctrl->nports,
+ GFP_KERNEL);
if (!pconfig)
return -ENOMEM;
diff --git a/drivers/soundwire/slave.c b/drivers/soundwire/slave.c
index d933cebad52b..45e80b9496f4 100644
--- a/drivers/soundwire/slave.c
+++ b/drivers/soundwire/slave.c
@@ -32,7 +32,7 @@ int sdw_slave_add(struct sdw_bus *bus,
int ret;
int i;
- slave = kzalloc(sizeof(*slave), GFP_KERNEL);
+ slave = kzalloc_obj(*slave, GFP_KERNEL);
if (!slave)
return -ENOMEM;
diff --git a/drivers/soundwire/stream.c b/drivers/soundwire/stream.c
index 38c9dbd35606..c6e3f911371b 100644
--- a/drivers/soundwire/stream.c
+++ b/drivers/soundwire/stream.c
@@ -748,11 +748,11 @@ static int sdw_bank_switch(struct sdw_bus *bus, int m_rt_count)
int ret;
u16 addr;
- wr_msg = kzalloc(sizeof(*wr_msg), GFP_KERNEL);
+ wr_msg = kzalloc_obj(*wr_msg, GFP_KERNEL);
if (!wr_msg)
return -ENOMEM;
- wbuf = kzalloc(sizeof(*wbuf), GFP_KERNEL);
+ wbuf = kzalloc_obj(*wbuf, GFP_KERNEL);
if (!wbuf) {
ret = -ENOMEM;
goto error_1;
@@ -956,7 +956,7 @@ static struct sdw_port_runtime *sdw_port_alloc(struct list_head *port_list)
{
struct sdw_port_runtime *p_rt;
- p_rt = kzalloc(sizeof(*p_rt), GFP_KERNEL);
+ p_rt = kzalloc_obj(*p_rt, GFP_KERNEL);
if (!p_rt)
return NULL;
@@ -1131,7 +1131,7 @@ static struct sdw_slave_runtime
{
struct sdw_slave_runtime *s_rt;
- s_rt = kzalloc(sizeof(*s_rt), GFP_KERNEL);
+ s_rt = kzalloc_obj(*s_rt, GFP_KERNEL);
if (!s_rt)
return NULL;
@@ -1241,7 +1241,7 @@ static struct sdw_master_runtime
}
}
- m_rt = kzalloc(sizeof(*m_rt), GFP_KERNEL);
+ m_rt = kzalloc_obj(*m_rt, GFP_KERNEL);
if (!m_rt)
return NULL;
@@ -1875,7 +1875,7 @@ struct sdw_stream_runtime *sdw_alloc_stream(const char *stream_name, enum sdw_st
{
struct sdw_stream_runtime *stream;
- stream = kzalloc(sizeof(*stream), GFP_KERNEL);
+ stream = kzalloc_obj(*stream, GFP_KERNEL);
if (!stream)
return NULL;