Skip to content

Commit e135eee

Browse files
tobluxtiwai
authored andcommitted
ALSA: aoa: Remove redundant size arguments from strscpy()
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>
1 parent 3c30d57 commit e135eee

5 files changed

Lines changed: 10 additions & 13 deletions

File tree

sound/aoa/codecs/onyx.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -973,7 +973,7 @@ static int onyx_i2c_probe(struct i2c_client *client)
973973
goto fail;
974974
}
975975

976-
strscpy(onyx->codec.name, "onyx", MAX_CODEC_NAME_LEN);
976+
strscpy(onyx->codec.name, "onyx");
977977
onyx->codec.owner = THIS_MODULE;
978978
onyx->codec.init = onyx_init_codec;
979979
onyx->codec.exit = onyx_exit_codec;

sound/aoa/codecs/tas.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -857,7 +857,7 @@ static int tas_i2c_probe(struct i2c_client *client)
857857
/* seems that half is a saner default */
858858
tas->drc_range = TAS3004_DRC_MAX / 2;
859859

860-
strscpy(tas->codec.name, "tas", MAX_CODEC_NAME_LEN);
860+
strscpy(tas->codec.name, "tas");
861861
tas->codec.owner = THIS_MODULE;
862862
tas->codec.init = tas_init_codec;
863863
tas->codec.exit = tas_exit_codec;

sound/aoa/codecs/toonie.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ static int __init toonie_init(void)
126126
if (!toonie)
127127
return -ENOMEM;
128128

129-
strscpy(toonie->codec.name, "toonie", sizeof(toonie->codec.name));
129+
strscpy(toonie->codec.name, "toonie");
130130
toonie->codec.owner = THIS_MODULE;
131131
toonie->codec.init = toonie_init_codec;
132132
toonie->codec.exit = toonie_exit_codec;

sound/aoa/core/alsa.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,10 @@ int aoa_alsa_init(char *name, struct module *mod, struct device *dev)
2828
return err;
2929
aoa_card = alsa_card->private_data;
3030
aoa_card->alsa_card = alsa_card;
31-
strscpy(alsa_card->driver, "AppleOnbdAudio", sizeof(alsa_card->driver));
32-
strscpy(alsa_card->shortname, name, sizeof(alsa_card->shortname));
33-
strscpy(alsa_card->longname, name, sizeof(alsa_card->longname));
34-
strscpy(alsa_card->mixername, name, sizeof(alsa_card->mixername));
31+
strscpy(alsa_card->driver, "AppleOnbdAudio");
32+
strscpy(alsa_card->shortname, name);
33+
strscpy(alsa_card->longname, name);
34+
strscpy(alsa_card->mixername, name);
3535
err = snd_card_register(aoa_card->alsa_card);
3636
if (err < 0) {
3737
printk(KERN_ERR "snd-aoa: couldn't register alsa card\n");

sound/aoa/fabrics/layout.c

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -949,8 +949,7 @@ static void layout_attached_codec(struct aoa_codec *codec)
949949
ldev->gpio.methods->set_lineout(codec->gpio, 1);
950950
ctl = snd_ctl_new1(&lineout_ctl, codec->gpio);
951951
if (cc->connected & CC_LINEOUT_LABELLED_HEADPHONE)
952-
strscpy(ctl->id.name,
953-
"Headphone Switch", sizeof(ctl->id.name));
952+
strscpy(ctl->id.name, "Headphone Switch");
954953
ldev->lineout_ctrl = ctl;
955954
aoa_snd_ctl_add(ctl);
956955
ldev->have_lineout_detect =
@@ -964,15 +963,13 @@ static void layout_attached_codec(struct aoa_codec *codec)
964963
ldev);
965964
if (cc->connected & CC_LINEOUT_LABELLED_HEADPHONE)
966965
strscpy(ctl->id.name,
967-
"Headphone Detect Autoswitch",
968-
sizeof(ctl->id.name));
966+
"Headphone Detect Autoswitch");
969967
aoa_snd_ctl_add(ctl);
970968
ctl = snd_ctl_new1(&lineout_detected,
971969
ldev);
972970
if (cc->connected & CC_LINEOUT_LABELLED_HEADPHONE)
973971
strscpy(ctl->id.name,
974-
"Headphone Detected",
975-
sizeof(ctl->id.name));
972+
"Headphone Detected");
976973
ldev->lineout_detected_ctrl = ctl;
977974
aoa_snd_ctl_add(ctl);
978975
}

0 commit comments

Comments
 (0)