mirror of
https://github.com/torvalds/linux.git
synced 2026-06-01 19:13:47 +02:00
ASoC: SDCA: Use __free() to manage local buffers
Use the cleanup.h helpers to manage some local buffers, this cleans up the error paths a little. Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com> Link: https://patch.msgid.link/20250312172205.4152686-3-ckeepax@opensource.cirrus.com Signed-off-by: Mark Brown <broonie@kernel.org>
This commit is contained in:
parent
988adcb736
commit
0d16daa940
|
|
@ -913,9 +913,9 @@ static int find_sdca_entity_pde(struct device *dev,
|
|||
{
|
||||
static const int mult_delay = 3;
|
||||
struct sdca_entity_pde *power = &entity->pde;
|
||||
u32 *delay_list __free(kfree) = NULL;
|
||||
struct sdca_pde_delay *delays;
|
||||
int num_delays;
|
||||
u32 *delay_list;
|
||||
int i, j;
|
||||
|
||||
num_delays = fwnode_property_count_u32(entity_node,
|
||||
|
|
@ -962,8 +962,6 @@ static int find_sdca_entity_pde(struct device *dev,
|
|||
power->num_max_delay = num_delays;
|
||||
power->max_delay = delays;
|
||||
|
||||
kfree(delay_list);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
@ -1022,8 +1020,8 @@ static int find_sdca_entities(struct device *dev,
|
|||
struct fwnode_handle *function_node,
|
||||
struct sdca_function_data *function)
|
||||
{
|
||||
u32 *entity_list __free(kfree) = NULL;
|
||||
struct sdca_entity *entities;
|
||||
u32 *entity_list;
|
||||
int num_entities;
|
||||
int i, ret;
|
||||
|
||||
|
|
@ -1054,8 +1052,6 @@ static int find_sdca_entities(struct device *dev,
|
|||
for (i = 0; i < num_entities; i++)
|
||||
entities[i].id = entity_list[i];
|
||||
|
||||
kfree(entity_list);
|
||||
|
||||
/* now read subproperties */
|
||||
for (i = 0; i < num_entities; i++) {
|
||||
char entity_property[SDCA_PROPERTY_LENGTH];
|
||||
|
|
@ -1170,8 +1166,8 @@ static int find_sdca_entity_connection_pde(struct device *dev,
|
|||
struct sdca_entity *entity)
|
||||
{
|
||||
struct sdca_entity_pde *power = &entity->pde;
|
||||
u32 *managed_list __free(kfree) = NULL;
|
||||
struct sdca_entity **managed;
|
||||
u32 *managed_list;
|
||||
int num_managed;
|
||||
int i;
|
||||
|
||||
|
|
@ -1205,15 +1201,12 @@ static int find_sdca_entity_connection_pde(struct device *dev,
|
|||
if (!managed[i]) {
|
||||
dev_err(dev, "%s: failed to find entity with id %#x\n",
|
||||
entity->label, managed_list[i]);
|
||||
kfree(managed_list);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
dev_info(dev, "%s -> %s\n", managed[i]->label, entity->label);
|
||||
}
|
||||
|
||||
kfree(managed_list);
|
||||
|
||||
power->num_managed = num_managed;
|
||||
power->managed = managed;
|
||||
|
||||
|
|
@ -1453,9 +1446,9 @@ static int find_sdca_clusters(struct device *dev,
|
|||
struct fwnode_handle *function_node,
|
||||
struct sdca_function_data *function)
|
||||
{
|
||||
u32 *cluster_list __free(kfree) = NULL;
|
||||
struct sdca_cluster *clusters;
|
||||
int num_clusters;
|
||||
u32 *cluster_list;
|
||||
int i, ret;
|
||||
|
||||
num_clusters = fwnode_property_count_u32(function_node, "mipi-sdca-cluster-id-list");
|
||||
|
|
@ -1484,8 +1477,6 @@ static int find_sdca_clusters(struct device *dev,
|
|||
for (i = 0; i < num_clusters; i++)
|
||||
clusters[i].id = cluster_list[i];
|
||||
|
||||
kfree(cluster_list);
|
||||
|
||||
/* now read subproperties */
|
||||
for (i = 0; i < num_clusters; i++) {
|
||||
char cluster_property[SDCA_PROPERTY_LENGTH];
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user