Unverified Commit 7445dfb5 authored by Mark Brown's avatar Mark Brown
Browse files

ASoC: amd/sdw: Fix confusing cleanup.h

Merge series from Krzysztof Kozlowski <krzysztof.kozlowski@oss.qualcomm.com>:

cleanup.h coding style asks to avoid having constructors with redundant
values (= NULL). On purpose, because it is just not making the code
simpler. The constructor should be meaningful not just NULL.

If you do not agree in declaration-in-place-of-use (fair!), then do not
use cleanup.h. If you want to use cleanup.h, then please read cleanup.h
before.
parents 34bf40c2 e3901118
Loading
Loading
Loading
Loading
+4 −4
Original line number Diff line number Diff line
@@ -358,8 +358,6 @@ static int soc_card_dai_links_create(struct snd_soc_card *card)
	int sdw_be_num = 0, dmic_num = 0;
	struct asoc_sdw_mc_private *ctx = snd_soc_card_get_drvdata(card);
	struct snd_soc_acpi_mach_params *mach_params = &mach->mach_params;
	struct asoc_sdw_endpoint *soc_ends __free(kfree) = NULL;
	struct asoc_sdw_dailink *soc_dais __free(kfree) = NULL;
	struct snd_soc_aux_dev *soc_aux;
	struct snd_soc_codec_conf *codec_conf;
	struct snd_soc_dai_link *dai_links;
@@ -380,12 +378,14 @@ static int soc_card_dai_links_create(struct snd_soc_card *card)
	num_confs = num_ends;

	/* One per DAI link, worst case is a DAI link for every endpoint */
	soc_dais = kcalloc(num_ends, sizeof(*soc_dais), GFP_KERNEL);
	struct asoc_sdw_dailink *soc_dais __free(kfree) =
		kcalloc(num_ends, sizeof(*soc_dais), GFP_KERNEL);
	if (!soc_dais)
		return -ENOMEM;

	/* One per endpoint, ie. each DAI on each codec/amp */
	soc_ends = kcalloc(num_ends, sizeof(*soc_ends), GFP_KERNEL);
	struct asoc_sdw_endpoint *soc_ends __free(kfree) =
		kcalloc(num_ends, sizeof(*soc_ends), GFP_KERNEL);
	if (!soc_ends)
		return -ENOMEM;

+4 −4
Original line number Diff line number Diff line
@@ -270,8 +270,6 @@ static int sof_card_dai_links_create(struct snd_soc_card *card)
	int sdw_be_num = 0, dmic_num = 0;
	struct asoc_sdw_mc_private *ctx = snd_soc_card_get_drvdata(card);
	struct snd_soc_acpi_mach_params *mach_params = &mach->mach_params;
	struct asoc_sdw_endpoint *sof_ends __free(kfree) = NULL;
	struct asoc_sdw_dailink *sof_dais __free(kfree) = NULL;
	struct snd_soc_aux_dev *sof_aux;
	struct snd_soc_codec_conf *codec_conf;
	struct snd_soc_dai_link *dai_links;
@@ -289,12 +287,14 @@ static int sof_card_dai_links_create(struct snd_soc_card *card)
	}

	/* One per DAI link, worst case is a DAI link for every endpoint */
	sof_dais = kcalloc(num_ends, sizeof(*sof_dais), GFP_KERNEL);
	struct asoc_sdw_dailink *sof_dais __free(kfree) =
		kcalloc(num_ends, sizeof(*sof_dais), GFP_KERNEL);
	if (!sof_dais)
		return -ENOMEM;

	/* One per endpoint, ie. each DAI on each codec/amp */
	sof_ends = kcalloc(num_ends, sizeof(*sof_ends), GFP_KERNEL);
	struct asoc_sdw_endpoint *sof_ends __free(kfree) =
		kcalloc(num_ends, sizeof(*sof_ends), GFP_KERNEL);
	if (!sof_ends)
		return -ENOMEM;

+14 −14
Original line number Diff line number Diff line
@@ -1184,7 +1184,6 @@ 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;
	int i, j;
@@ -1205,7 +1204,8 @@ static int find_sdca_entity_pde(struct device *dev,
		return -EINVAL;
	}

	delay_list = kcalloc(num_delays, sizeof(*delay_list), GFP_KERNEL);
	u32 *delay_list __free(kfree) = kcalloc(num_delays, sizeof(*delay_list),
						GFP_KERNEL);
	if (!delay_list)
		return -ENOMEM;

@@ -1250,7 +1250,6 @@ static int find_sdca_entity_ge(struct device *dev,
			       struct sdca_entity *entity)
{
	struct sdca_entity_ge *group = &entity->ge;
	u8 *affected_list __free(kfree) = NULL;
	u8 *affected_iter;
	int num_affected;
	int i, j;
@@ -1269,7 +1268,8 @@ static int find_sdca_entity_ge(struct device *dev,
		return -EINVAL;
	}

	affected_list = kcalloc(num_affected, sizeof(*affected_list), GFP_KERNEL);
	u8 *affected_list __free(kfree) = kcalloc(num_affected, sizeof(*affected_list),
						  GFP_KERNEL);
	if (!affected_list)
		return -ENOMEM;

@@ -1495,7 +1495,6 @@ static int find_sdca_entities(struct device *dev, struct sdw_slave *sdw,
			      struct fwnode_handle *function_node,
			      struct sdca_function_data *function)
{
	u32 *entity_list __free(kfree) = NULL;
	struct sdca_entity *entities;
	int num_entities;
	int i, ret;
@@ -1517,7 +1516,8 @@ static int find_sdca_entities(struct device *dev, struct sdw_slave *sdw,
	if (!entities)
		return -ENOMEM;

	entity_list = kcalloc(num_entities, sizeof(*entity_list), GFP_KERNEL);
	u32 *entity_list __free(kfree) = kcalloc(num_entities, sizeof(*entity_list),
						 GFP_KERNEL);
	if (!entity_list)
		return -ENOMEM;

@@ -1642,7 +1642,6 @@ 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;
	int num_managed;
	int i;
@@ -1664,7 +1663,8 @@ static int find_sdca_entity_connection_pde(struct device *dev,
	if (!managed)
		return -ENOMEM;

	managed_list = kcalloc(num_managed, sizeof(*managed_list), GFP_KERNEL);
	u32 *managed_list __free(kfree) = kcalloc(num_managed, sizeof(*managed_list),
						  GFP_KERNEL);
	if (!managed_list)
		return -ENOMEM;

@@ -1961,7 +1961,6 @@ 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;
	int i, ret;
@@ -1982,7 +1981,8 @@ static int find_sdca_clusters(struct device *dev,
	if (!clusters)
		return -ENOMEM;

	cluster_list = kcalloc(num_clusters, sizeof(*cluster_list), GFP_KERNEL);
	u32 *cluster_list __free(kfree) = kcalloc(num_clusters, sizeof(*cluster_list),
						  GFP_KERNEL);
	if (!cluster_list)
		return -ENOMEM;

@@ -2026,7 +2026,6 @@ static int find_sdca_filesets(struct device *dev, struct sdw_slave *sdw,
{
	static const int mult_fileset = 3;
	char fileset_name[SDCA_PROPERTY_LENGTH];
	u32 *filesets_list __free(kfree) = NULL;
	struct sdca_fdl_set *sets;
	int num_sets;
	int i, j;
@@ -2041,7 +2040,8 @@ static int find_sdca_filesets(struct device *dev, struct sdw_slave *sdw,
		return num_sets;
	}

	filesets_list = kcalloc(num_sets, sizeof(u32), GFP_KERNEL);
	u32 *filesets_list __free(kfree) = kcalloc(num_sets, sizeof(u32),
						   GFP_KERNEL);
	if (!filesets_list)
		return -ENOMEM;

@@ -2053,7 +2053,6 @@ static int find_sdca_filesets(struct device *dev, struct sdw_slave *sdw,
		return -ENOMEM;

	for (i = 0; i < num_sets; i++) {
		u32 *fileset_entries __free(kfree) = NULL;
		struct sdca_fdl_set *set = &sets[i];
		struct sdca_fdl_file *files;
		int num_files, num_entries;
@@ -2079,7 +2078,8 @@ static int find_sdca_filesets(struct device *dev, struct sdw_slave *sdw,
		if (!files)
			return -ENOMEM;

		fileset_entries = kcalloc(num_entries, sizeof(u32), GFP_KERNEL);
		u32 *fileset_entries __free(kfree) = kcalloc(num_entries, sizeof(u32),
							     GFP_KERNEL);
		if (!fileset_entries)
			return -ENOMEM;