]> www.infradead.org Git - users/hch/misc.git/commitdiff
ALSA: aoa: Remove redundant size arguments from strscpy()
authorThorsten Blum <thorsten.blum@linux.dev>
Thu, 11 Sep 2025 21:43:22 +0000 (23:43 +0200)
committerTakashi Iwai <tiwai@suse.de>
Fri, 12 Sep 2025 05:54:40 +0000 (07:54 +0200)
The size parameter of strscpy() is optional if the destination buffer
has a fixed length and strscpy() can automatically determine its size
using sizeof(). This makes many explicit size arguments redundant.

Remove them to shorten and simplify the code.

No functional changes intended.

Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
sound/aoa/codecs/onyx.c
sound/aoa/codecs/tas.c
sound/aoa/codecs/toonie.c
sound/aoa/core/alsa.c
sound/aoa/fabrics/layout.c

index 7400a5aa47ca64417a28dd8647983d9c77925e98..4cf959017c9d5067f4762d1dbb0357e5834250cf 100644 (file)
@@ -973,7 +973,7 @@ static int onyx_i2c_probe(struct i2c_client *client)
                goto fail;
        }
 
-       strscpy(onyx->codec.name, "onyx", MAX_CODEC_NAME_LEN);
+       strscpy(onyx->codec.name, "onyx");
        onyx->codec.owner = THIS_MODULE;
        onyx->codec.init = onyx_init_codec;
        onyx->codec.exit = onyx_exit_codec;
index 70216aa059650e587748750466c4447d7fd24b3c..7085e0b93e29b469463ce42d8ec71b5e42398408 100644 (file)
@@ -857,7 +857,7 @@ static int tas_i2c_probe(struct i2c_client *client)
        /* seems that half is a saner default */
        tas->drc_range = TAS3004_DRC_MAX / 2;
 
-       strscpy(tas->codec.name, "tas", MAX_CODEC_NAME_LEN);
+       strscpy(tas->codec.name, "tas");
        tas->codec.owner = THIS_MODULE;
        tas->codec.init = tas_init_codec;
        tas->codec.exit = tas_exit_codec;
index 0da5af12949280c485c2dff2016bb2076b956d8d..b59967c49e0a2c589e194fcafc2db0b06e6af27c 100644 (file)
@@ -126,7 +126,7 @@ static int __init toonie_init(void)
        if (!toonie)
                return -ENOMEM;
 
-       strscpy(toonie->codec.name, "toonie", sizeof(toonie->codec.name));
+       strscpy(toonie->codec.name, "toonie");
        toonie->codec.owner = THIS_MODULE;
        toonie->codec.init = toonie_init_codec;
        toonie->codec.exit = toonie_exit_codec;
index 7fce8581ddbd12b1522b0d0a9a572f4fc840b267..aad7dfe089c7d8b8c0f65320cf976630cb73c4b2 100644 (file)
@@ -28,10 +28,10 @@ int aoa_alsa_init(char *name, struct module *mod, struct device *dev)
                return err;
        aoa_card = alsa_card->private_data;
        aoa_card->alsa_card = alsa_card;
-       strscpy(alsa_card->driver, "AppleOnbdAudio", sizeof(alsa_card->driver));
-       strscpy(alsa_card->shortname, name, sizeof(alsa_card->shortname));
-       strscpy(alsa_card->longname, name, sizeof(alsa_card->longname));
-       strscpy(alsa_card->mixername, name, sizeof(alsa_card->mixername));
+       strscpy(alsa_card->driver, "AppleOnbdAudio");
+       strscpy(alsa_card->shortname, name);
+       strscpy(alsa_card->longname, name);
+       strscpy(alsa_card->mixername, name);
        err = snd_card_register(aoa_card->alsa_card);
        if (err < 0) {
                printk(KERN_ERR "snd-aoa: couldn't register alsa card\n");
index e68b4cb4df296aa2d01929a32cc765ede53ef879..bb2a0ef3004bf8cc26e3b42b0e9c83306d6689c6 100644 (file)
@@ -949,8 +949,7 @@ static void layout_attached_codec(struct aoa_codec *codec)
                                ldev->gpio.methods->set_lineout(codec->gpio, 1);
                        ctl = snd_ctl_new1(&lineout_ctl, codec->gpio);
                        if (cc->connected & CC_LINEOUT_LABELLED_HEADPHONE)
-                               strscpy(ctl->id.name,
-                                       "Headphone Switch", sizeof(ctl->id.name));
+                               strscpy(ctl->id.name, "Headphone Switch");
                        ldev->lineout_ctrl = ctl;
                        aoa_snd_ctl_add(ctl);
                        ldev->have_lineout_detect =
@@ -964,15 +963,13 @@ static void layout_attached_codec(struct aoa_codec *codec)
                                                   ldev);
                                if (cc->connected & CC_LINEOUT_LABELLED_HEADPHONE)
                                        strscpy(ctl->id.name,
-                                               "Headphone Detect Autoswitch",
-                                               sizeof(ctl->id.name));
+                                               "Headphone Detect Autoswitch");
                                aoa_snd_ctl_add(ctl);
                                ctl = snd_ctl_new1(&lineout_detected,
                                                   ldev);
                                if (cc->connected & CC_LINEOUT_LABELLED_HEADPHONE)
                                        strscpy(ctl->id.name,
-                                               "Headphone Detected",
-                                               sizeof(ctl->id.name));
+                                               "Headphone Detected");
                                ldev->lineout_detected_ctrl = ctl;
                                aoa_snd_ctl_add(ctl);
                        }