mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-11-11 04:18:39 +08:00
ALSA: serial: Fix assignment in if condition
A few ALSA serial drivers contain assignments in if condition, which is a bad coding style that may confuse readers and occasionally lead to bugs. This patch is merely for coding-style fixes, no functional changes. Link: https://lore.kernel.org/r/20210608140540.17885-63-tiwai@suse.de Signed-off-by: Takashi Iwai <tiwai@suse.de>
This commit is contained in:
parent
9c78e80319
commit
d0ad13ef70
@ -566,7 +566,8 @@ static irqreturn_t snd_mtpav_irqh(int irq, void *dev_id)
|
||||
*/
|
||||
static int snd_mtpav_get_ISA(struct mtpav *mcard)
|
||||
{
|
||||
if ((mcard->res_port = request_region(port, 3, "MotuMTPAV MIDI")) == NULL) {
|
||||
mcard->res_port = request_region(port, 3, "MotuMTPAV MIDI");
|
||||
if (!mcard->res_port) {
|
||||
snd_printk(KERN_ERR "MTVAP port 0x%lx is busy\n", port);
|
||||
return -EBUSY;
|
||||
}
|
||||
@ -628,10 +629,11 @@ static int snd_mtpav_get_RAWMIDI(struct mtpav *mcard)
|
||||
hwports = 8;
|
||||
mcard->num_ports = hwports;
|
||||
|
||||
if ((rval = snd_rawmidi_new(mcard->card, "MotuMIDI", 0,
|
||||
mcard->num_ports * 2 + MTPAV_PIDX_BROADCAST + 1,
|
||||
mcard->num_ports * 2 + MTPAV_PIDX_BROADCAST + 1,
|
||||
&mcard->rmidi)) < 0)
|
||||
rval = snd_rawmidi_new(mcard->card, "MotuMIDI", 0,
|
||||
mcard->num_ports * 2 + MTPAV_PIDX_BROADCAST + 1,
|
||||
mcard->num_ports * 2 + MTPAV_PIDX_BROADCAST + 1,
|
||||
&mcard->rmidi);
|
||||
if (rval < 0)
|
||||
return rval;
|
||||
rawmidi = mcard->rmidi;
|
||||
rawmidi->private_data = mcard;
|
||||
@ -744,7 +746,8 @@ static int __init alsa_card_mtpav_init(void)
|
||||
{
|
||||
int err;
|
||||
|
||||
if ((err = platform_driver_register(&snd_mtpav_driver)) < 0)
|
||||
err = platform_driver_register(&snd_mtpav_driver);
|
||||
if (err < 0)
|
||||
return err;
|
||||
|
||||
device = platform_device_register_simple(SND_MTPAV_DRIVER, -1, NULL, 0);
|
||||
|
@ -950,7 +950,8 @@ static int snd_mts64_probe(struct platform_device *pdev)
|
||||
goto free_pardev;
|
||||
}
|
||||
|
||||
if ((err = snd_mts64_create(card, pardev, &mts)) < 0) {
|
||||
err = snd_mts64_create(card, pardev, &mts);
|
||||
if (err < 0) {
|
||||
snd_printd("Cannot create main component\n");
|
||||
goto release_pardev;
|
||||
}
|
||||
@ -963,19 +964,22 @@ static int snd_mts64_probe(struct platform_device *pdev)
|
||||
goto __err;
|
||||
}
|
||||
|
||||
if ((err = snd_mts64_rawmidi_create(card)) < 0) {
|
||||
err = snd_mts64_rawmidi_create(card);
|
||||
if (err < 0) {
|
||||
snd_printd("Creating Rawmidi component failed\n");
|
||||
goto __err;
|
||||
}
|
||||
|
||||
/* init device */
|
||||
if ((err = mts64_device_init(p)) < 0)
|
||||
err = mts64_device_init(p);
|
||||
if (err < 0)
|
||||
goto __err;
|
||||
|
||||
platform_set_drvdata(pdev, card);
|
||||
|
||||
/* At this point card will be usable */
|
||||
if ((err = snd_card_register(card)) < 0) {
|
||||
err = snd_card_register(card);
|
||||
if (err < 0) {
|
||||
snd_printd("Cannot register card\n");
|
||||
goto __err;
|
||||
}
|
||||
@ -1031,7 +1035,8 @@ static int __init snd_mts64_module_init(void)
|
||||
{
|
||||
int err;
|
||||
|
||||
if ((err = platform_driver_register(&snd_mts64_driver)) < 0)
|
||||
err = platform_driver_register(&snd_mts64_driver);
|
||||
if (err < 0)
|
||||
return err;
|
||||
|
||||
if (parport_register_driver(&mts64_parport_driver) != 0) {
|
||||
|
@ -749,7 +749,8 @@ static int snd_portman_probe(struct platform_device *pdev)
|
||||
goto free_pardev;
|
||||
}
|
||||
|
||||
if ((err = portman_create(card, pardev, &pm)) < 0) {
|
||||
err = portman_create(card, pardev, &pm);
|
||||
if (err < 0) {
|
||||
snd_printd("Cannot create main component\n");
|
||||
goto release_pardev;
|
||||
}
|
||||
@ -762,19 +763,22 @@ static int snd_portman_probe(struct platform_device *pdev)
|
||||
goto __err;
|
||||
}
|
||||
|
||||
if ((err = snd_portman_rawmidi_create(card)) < 0) {
|
||||
err = snd_portman_rawmidi_create(card);
|
||||
if (err < 0) {
|
||||
snd_printd("Creating Rawmidi component failed\n");
|
||||
goto __err;
|
||||
}
|
||||
|
||||
/* init device */
|
||||
if ((err = portman_device_init(pm)) < 0)
|
||||
err = portman_device_init(pm);
|
||||
if (err < 0)
|
||||
goto __err;
|
||||
|
||||
platform_set_drvdata(pdev, card);
|
||||
|
||||
/* At this point card will be usable */
|
||||
if ((err = snd_card_register(card)) < 0) {
|
||||
err = snd_card_register(card);
|
||||
if (err < 0) {
|
||||
snd_printd("Cannot register card\n");
|
||||
goto __err;
|
||||
}
|
||||
@ -831,7 +835,8 @@ static int __init snd_portman_module_init(void)
|
||||
{
|
||||
int err;
|
||||
|
||||
if ((err = platform_driver_register(&snd_portman_driver)) < 0)
|
||||
err = platform_driver_register(&snd_portman_driver);
|
||||
if (err < 0)
|
||||
return err;
|
||||
|
||||
if (parport_register_driver(&portman_parport_driver) != 0) {
|
||||
|
@ -783,7 +783,8 @@ static int snd_uart16550_create(struct snd_card *card,
|
||||
int err;
|
||||
|
||||
|
||||
if ((uart = kzalloc(sizeof(*uart), GFP_KERNEL)) == NULL)
|
||||
uart = kzalloc(sizeof(*uart), GFP_KERNEL);
|
||||
if (!uart)
|
||||
return -ENOMEM;
|
||||
uart->adaptor = adaptor;
|
||||
uart->card = card;
|
||||
@ -792,7 +793,8 @@ static int snd_uart16550_create(struct snd_card *card,
|
||||
uart->base = iobase;
|
||||
uart->drop_on_full = droponfull;
|
||||
|
||||
if ((err = snd_uart16550_detect(uart)) <= 0) {
|
||||
err = snd_uart16550_detect(uart);
|
||||
if (err <= 0) {
|
||||
printk(KERN_ERR "no UART detected at 0x%lx\n", iobase);
|
||||
snd_uart16550_free(uart);
|
||||
return -ENODEV;
|
||||
@ -818,7 +820,8 @@ static int snd_uart16550_create(struct snd_card *card,
|
||||
uart->timer_running = 0;
|
||||
|
||||
/* Register device */
|
||||
if ((err = snd_device_new(card, SNDRV_DEV_LOWLEVEL, uart, &ops)) < 0) {
|
||||
err = snd_device_new(card, SNDRV_DEV_LOWLEVEL, uart, &ops);
|
||||
if (err < 0) {
|
||||
snd_uart16550_free(uart);
|
||||
return err;
|
||||
}
|
||||
@ -932,14 +935,10 @@ static int snd_serial_probe(struct platform_device *devptr)
|
||||
strcpy(card->driver, "Serial");
|
||||
strcpy(card->shortname, "Serial MIDI (UART16550A)");
|
||||
|
||||
if ((err = snd_uart16550_create(card,
|
||||
port[dev],
|
||||
irq[dev],
|
||||
speed[dev],
|
||||
base[dev],
|
||||
adaptor[dev],
|
||||
droponfull[dev],
|
||||
&uart)) < 0)
|
||||
err = snd_uart16550_create(card, port[dev], irq[dev], speed[dev],
|
||||
base[dev], adaptor[dev], droponfull[dev],
|
||||
&uart);
|
||||
if (err < 0)
|
||||
goto _err;
|
||||
|
||||
err = snd_uart16550_rmidi(uart, 0, outs[dev], ins[dev], &uart->rmidi);
|
||||
@ -952,7 +951,8 @@ static int snd_serial_probe(struct platform_device *devptr)
|
||||
uart->base,
|
||||
uart->irq);
|
||||
|
||||
if ((err = snd_card_register(card)) < 0)
|
||||
err = snd_card_register(card);
|
||||
if (err < 0)
|
||||
goto _err;
|
||||
|
||||
platform_set_drvdata(devptr, card);
|
||||
@ -992,7 +992,8 @@ static int __init alsa_card_serial_init(void)
|
||||
{
|
||||
int i, cards, err;
|
||||
|
||||
if ((err = platform_driver_register(&snd_serial_driver)) < 0)
|
||||
err = platform_driver_register(&snd_serial_driver);
|
||||
if (err < 0)
|
||||
return err;
|
||||
|
||||
cards = 0;
|
||||
|
Loading…
Reference in New Issue
Block a user