[next] ALSA: oxfw: make read-only const array models static

Message ID 20230627113253.700065-1-colin.i.king@gmail.com
State New
Headers
Series [next] ALSA: oxfw: make read-only const array models static |

Commit Message

Colin Ian King June 27, 2023, 11:32 a.m. UTC
  Don't populate the const array on the stack, instead make it static.

Signed-off-by: Colin Ian King <colin.i.king@gmail.com>
---
 sound/firewire/oxfw/oxfw.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
  

Comments

Takashi Sakamoto June 27, 2023, 11:36 p.m. UTC | #1
Hi,

On Tue, Jun 27, 2023 at 12:32:53PM +0100, Colin Ian King wrote:
> Don't populate the const array on the stack, instead make it static.
> 
> Signed-off-by: Colin Ian King <colin.i.king@gmail.com>
> ---
>  sound/firewire/oxfw/oxfw.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/sound/firewire/oxfw/oxfw.c b/sound/firewire/oxfw/oxfw.c
> index 9523479fa94a..63d40f1a914f 100644
> --- a/sound/firewire/oxfw/oxfw.c
> +++ b/sound/firewire/oxfw/oxfw.c
> @@ -44,7 +44,7 @@ struct compat_info {
>  
>  static bool detect_loud_models(struct fw_unit *unit)
>  {
> -	const char *const models[] = {
> +	static const char *const models[] = {
>  		"Onyxi",
>  		"Onyx-i",
>  		"Onyx 1640i",
> -- 
> 2.39.2
 
Indeed. It is preferable.

Reviewed-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>

I found that ALSA fireface driver includes the similar issue. I'll send a
patch to fix it later.


Thanks

Takashi Sakamoto
  
Takashi Iwai June 28, 2023, 9:42 a.m. UTC | #2
On Tue, 27 Jun 2023 13:32:53 +0200,
Colin Ian King wrote:
> 
> Don't populate the const array on the stack, instead make it static.
> 
> Signed-off-by: Colin Ian King <colin.i.king@gmail.com>

Thanks, applied.


Takashi
  

Patch

diff --git a/sound/firewire/oxfw/oxfw.c b/sound/firewire/oxfw/oxfw.c
index 9523479fa94a..63d40f1a914f 100644
--- a/sound/firewire/oxfw/oxfw.c
+++ b/sound/firewire/oxfw/oxfw.c
@@ -44,7 +44,7 @@  struct compat_info {
 
 static bool detect_loud_models(struct fw_unit *unit)
 {
-	const char *const models[] = {
+	static const char *const models[] = {
 		"Onyxi",
 		"Onyx-i",
 		"Onyx 1640i",