[PATCH] ALSA: control: expand limitation on the number of user-defined control element set per card

Jaroslav Kysela perex at perex.cz
Tue Jan 26 17:25:24 CET 2021


Dne 26. 01. 21 v 16:57 Takashi Iwai napsal(a):

> @@ -1226,11 +1227,18 @@ struct user_element {
>  	struct snd_card *card;
>  	char *elem_data;		/* element data */
>  	unsigned long elem_data_size;	/* size of element data in bytes */
> +	size_t alloc_size;		/* allocated size */

I think that introduction of this new member is not required. The allocated
size can be easily computed at runtime (function).

> @@ -1397,6 +1414,7 @@ static int snd_ctl_elem_init_enum_names(struct user_element *ue)
>  
>  	ue->priv_data = names;
>  	ue->info.value.enumerated.names_ptr = 0;
> +	ue->alloc_size += buf_len;

The buf_len variable is the remaining count. The
ue->info.value.enumerated.names_length already contains allocated bytes. This
code can be elimited if alloc_size is not introduced.

Thank you for this patch.

					Jaroslav

-- 
Jaroslav Kysela <perex at perex.cz>
Linux Sound Maintainer; ALSA Project; Red Hat, Inc.


More information about the Alsa-devel mailing list