Ignore:
Timestamp:
Sep 26, 2021, 6:18:40 PM (4 years ago)
Author:
David Azarewicz
Message:

Merge changes from next branch.

Location:
GPL/trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • GPL/trunk

  • GPL/trunk/alsa-kernel/pci/ac97/ac97_codec.c

    r679 r703  
    13331333        if (snd_ac97_try_bit(ac97, reg, 15)) {
    13341334                sprintf(name, "%s Switch", pfx);
    1335                 if ((err = snd_ac97_cmute_new_stereo(card, name, reg,
    1336                                                      check_stereo, check_amix,
    1337                                                      ac97)) < 0)
     1335                err = snd_ac97_cmute_new_stereo(card, name, reg,
     1336                                                check_stereo, check_amix,
     1337                                                ac97);
     1338                if (err < 0)
    13381339                        return err;
    13391340        }
     
    13411342        if (lo_max) {
    13421343                sprintf(name, "%s Volume", pfx);
    1343                 if ((err = snd_ac97_cvol_new(card, name, reg, lo_max, hi_max, ac97)) < 0)
     1344                err = snd_ac97_cvol_new(card, name, reg, lo_max, hi_max, ac97);
     1345                if (err < 0)
    13441346                        return err;
    13451347        }
     
    13801382        if ((snd_ac97_try_volume_mix(ac97, AC97_CENTER_LFE_MASTER))
    13811383                && !(ac97->flags & AC97_AD_MULTI)) {
    1382                 if ((err = snd_ctl_add(card, snd_ac97_cnew(&snd_ac97_controls_center[0], ac97))) < 0)
     1384                err = snd_ctl_add(card, snd_ac97_cnew(&snd_ac97_controls_center[0], ac97));
     1385                if (err < 0)
    13831386                        return err;
    1384                 if ((err = snd_ctl_add(card, kctl = snd_ac97_cnew(&snd_ac97_controls_center[1], ac97))) < 0)
     1387                err = snd_ctl_add(card, kctl = snd_ac97_cnew(&snd_ac97_controls_center[1], ac97));
     1388                if (err < 0)
    13851389                        return err;
    13861390                snd_ac97_change_volume_params2(ac97, AC97_CENTER_LFE_MASTER, 0, &max);
     
    13941398        if ((snd_ac97_try_volume_mix(ac97, AC97_CENTER_LFE_MASTER+1))
    13951399                && !(ac97->flags & AC97_AD_MULTI)) {
    1396                 if ((err = snd_ctl_add(card, snd_ac97_cnew(&snd_ac97_controls_lfe[0], ac97))) < 0)
     1400                err = snd_ctl_add(card, snd_ac97_cnew(&snd_ac97_controls_lfe[0], ac97));
     1401                if (err < 0)
    13971402                        return err;
    1398                 if ((err = snd_ctl_add(card, kctl = snd_ac97_cnew(&snd_ac97_controls_lfe[1], ac97))) < 0)
     1403                err = snd_ctl_add(card, kctl = snd_ac97_cnew(&snd_ac97_controls_lfe[1], ac97));
     1404                if (err < 0)
    13991405                        return err;
    14001406                snd_ac97_change_volume_params2(ac97, AC97_CENTER_LFE_MASTER, 8, &max);
     
    14091415                && !(ac97->flags & AC97_AD_MULTI)) {
    14101416                /* Surround Master (0x38) is with stereo mutes */
    1411                 if ((err = snd_ac97_cmix_new_stereo(card, "Surround Playback",
    1412                                                     AC97_SURROUND_MASTER, 1, 0,
    1413                                                     ac97)) < 0)
     1417                err = snd_ac97_cmix_new_stereo(card, "Surround Playback",
     1418                                               AC97_SURROUND_MASTER, 1, 0,
     1419                                               ac97);
     1420                if (err < 0)
    14141421                        return err;
    14151422        }
     
    14171424        /* build headphone controls */
    14181425        if (snd_ac97_try_volume_mix(ac97, AC97_HEADPHONE)) {
    1419                 if ((err = snd_ac97_cmix_new(card, "Headphone Playback",
    1420                                              AC97_HEADPHONE, 0, ac97)) < 0)
     1426                err = snd_ac97_cmix_new(card, "Headphone Playback",
     1427                                        AC97_HEADPHONE, 0, ac97);
     1428                if (err < 0)
    14211429                        return err;
    14221430        }
     
    14241432        /* build master mono controls */
    14251433        if (snd_ac97_try_volume_mix(ac97, AC97_MASTER_MONO)) {
    1426                 if ((err = snd_ac97_cmix_new(card, "Master Mono Playback",
    1427                                              AC97_MASTER_MONO, 0, ac97)) < 0)
     1434                err = snd_ac97_cmix_new(card, "Master Mono Playback",
     1435                                        AC97_MASTER_MONO, 0, ac97);
     1436                if (err < 0)
    14281437                        return err;
    14291438        }
     
    14331442                if (snd_ac97_try_volume_mix(ac97, AC97_MASTER_TONE)) {
    14341443                        for (idx = 0; idx < 2; idx++) {
    1435                                 if ((err = snd_ctl_add(card, kctl = snd_ac97_cnew(&snd_ac97_controls_tone[idx], ac97))) < 0)
     1444                                kctl = snd_ac97_cnew(&snd_ac97_controls_tone[idx], ac97);
     1445                                err = snd_ctl_add(card, kctl);
     1446                                if (err < 0)
    14361447                                        return err;
    14371448                                if (ac97->id == AC97_ID_YMF743 ||
     
    14491460                ((ac97->flags & AC97_HAS_PC_BEEP) ||
    14501461            snd_ac97_try_volume_mix(ac97, AC97_PC_BEEP))) {
    1451                 for (idx = 0; idx < 2; idx++)
    1452                         if ((err = snd_ctl_add(card, kctl = snd_ac97_cnew(&snd_ac97_controls_pc_beep[idx], ac97))) < 0)
     1462                for (idx = 0; idx < 2; idx++) {
     1463                        kctl = snd_ac97_cnew(&snd_ac97_controls_pc_beep[idx], ac97);
     1464                        err = snd_ctl_add(card, kctl);
     1465                        if (err < 0)
    14531466                                return err;
     1467                }
    14541468                set_tlv_db_scale(kctl, db_scale_4bit);
    14551469                snd_ac97_write_cache(
     
    14641478        if (!(ac97->flags & AC97_HAS_NO_PHONE)) {
    14651479                if (snd_ac97_try_volume_mix(ac97, AC97_PHONE)) {
    1466                         if ((err = snd_ac97_cmix_new(card, "Phone Playback",
    1467                                                      AC97_PHONE, 1, ac97)) < 0)
     1480                        err = snd_ac97_cmix_new(card, "Phone Playback",
     1481                                                AC97_PHONE, 1, ac97);
     1482                        if (err < 0)
    14681483                                return err;
    14691484                }
     
    14731488        if (!(ac97->flags & AC97_HAS_NO_MIC)) {
    14741489                if (snd_ac97_try_volume_mix(ac97, AC97_MIC)) {
    1475                         if ((err = snd_ac97_cmix_new(card, "Mic Playback",
    1476                                                      AC97_MIC, 1, ac97)) < 0)
     1490                        err = snd_ac97_cmix_new(card, "Mic Playback",
     1491                                                AC97_MIC, 1, ac97);
     1492                        if (err < 0)
    14771493                                return err;
    1478                         if ((err = snd_ctl_add(card, snd_ac97_cnew(&snd_ac97_controls_mic_boost, ac97))) < 0)
     1494                        err = snd_ctl_add(card, snd_ac97_cnew(&snd_ac97_controls_mic_boost, ac97));
     1495                        if (err < 0)
    14791496                                return err;
    14801497                }
     
    14831500        /* build Line controls */
    14841501        if (snd_ac97_try_volume_mix(ac97, AC97_LINE)) {
    1485                 if ((err = snd_ac97_cmix_new(card, "Line Playback",
    1486                                              AC97_LINE, 1, ac97)) < 0)
     1502                err = snd_ac97_cmix_new(card, "Line Playback",
     1503                                        AC97_LINE, 1, ac97);
     1504                if (err < 0)
    14871505                        return err;
    14881506        }
     
    14911509        if (!(ac97->flags & AC97_HAS_NO_CD)) {
    14921510                if (snd_ac97_try_volume_mix(ac97, AC97_CD)) {
    1493                         if ((err = snd_ac97_cmix_new(card, "CD Playback",
    1494                                                      AC97_CD, 1, ac97)) < 0)
     1511                        err = snd_ac97_cmix_new(card, "CD Playback",
     1512                                                AC97_CD, 1, ac97);
     1513                        if (err < 0)
    14951514                                return err;
    14961515                }
     
    15001519        if (!(ac97->flags & AC97_HAS_NO_VIDEO)) {
    15011520                if (snd_ac97_try_volume_mix(ac97, AC97_VIDEO)) {
    1502                         if ((err = snd_ac97_cmix_new(card, "Video Playback",
    1503                                                      AC97_VIDEO, 1, ac97)) < 0)
     1521                        err = snd_ac97_cmix_new(card, "Video Playback",
     1522                                                AC97_VIDEO, 1, ac97);
     1523                        if (err < 0)
    15041524                                return err;
    15051525                }
     
    15091529        if (!(ac97->flags & AC97_HAS_NO_AUX)) {
    15101530                if (snd_ac97_try_volume_mix(ac97, AC97_AUX)) {
    1511                         if ((err = snd_ac97_cmix_new(card, "Aux Playback",
    1512                                                      AC97_AUX, 1, ac97)) < 0)
     1531                        err = snd_ac97_cmix_new(card, "Aux Playback",
     1532                                                AC97_AUX, 1, ac97);
     1533                        if (err < 0)
    15131534                                return err;
    15141535                }
     
    15221543                else
    15231544                        init_val = 0x9f1f;
    1524                 for (idx = 0; idx < 2; idx++)
    1525                         if ((err = snd_ctl_add(card, kctl = snd_ac97_cnew(&snd_ac97_controls_ad18xx_pcm[idx], ac97))) < 0)
     1545                for (idx = 0; idx < 2; idx++) {
     1546                        kctl = snd_ac97_cnew(&snd_ac97_controls_ad18xx_pcm[idx], ac97);
     1547                        err = snd_ctl_add(card, kctl);
     1548                        if (err < 0)
    15261549                                return err;
     1550                }
    15271551                set_tlv_db_scale(kctl, db_scale_5bit);
    15281552                ac97->spec.ad18xx.pcmreg[0] = init_val;
    15291553                if (ac97->scaps & AC97_SCAP_SURROUND_DAC) {
    1530                         for (idx = 0; idx < 2; idx++)
    1531                                 if ((err = snd_ctl_add(card, kctl = snd_ac97_cnew(&snd_ac97_controls_ad18xx_surround[idx], ac97))) < 0)
     1554                        for (idx = 0; idx < 2; idx++) {
     1555                                kctl = snd_ac97_cnew(&snd_ac97_controls_ad18xx_surround[idx], ac97);
     1556                                err = snd_ctl_add(card, kctl);
     1557                                if (err < 0)
    15321558                                        return err;
     1559                        }
    15331560                        set_tlv_db_scale(kctl, db_scale_5bit);
    15341561                        ac97->spec.ad18xx.pcmreg[1] = init_val;
    15351562                }
    15361563                if (ac97->scaps & AC97_SCAP_CENTER_LFE_DAC) {
    1537                         for (idx = 0; idx < 2; idx++)
    1538                                 if ((err = snd_ctl_add(card, kctl = snd_ac97_cnew(&snd_ac97_controls_ad18xx_center[idx], ac97))) < 0)
     1564                        for (idx = 0; idx < 2; idx++) {
     1565                                kctl = snd_ac97_cnew(&snd_ac97_controls_ad18xx_center[idx], ac97);
     1566                                err = snd_ctl_add(card, kctl);
     1567                                if (err < 0)
    15391568                                        return err;
     1569                        }
    15401570                        set_tlv_db_scale(kctl, db_scale_5bit);
    1541                         for (idx = 0; idx < 2; idx++)
    1542                                 if ((err = snd_ctl_add(card, kctl = snd_ac97_cnew(&snd_ac97_controls_ad18xx_lfe[idx], ac97))) < 0)
     1571                        for (idx = 0; idx < 2; idx++) {
     1572                                kctl = snd_ac97_cnew(&snd_ac97_controls_ad18xx_lfe[idx], ac97);
     1573                                err = snd_ctl_add(card, kctl);
     1574                                if (err < 0)
    15431575                                        return err;
     1576                        }
    15441577                        set_tlv_db_scale(kctl, db_scale_5bit);
    15451578                        ac97->spec.ad18xx.pcmreg[2] = init_val;
     
    15621595        /* build Capture controls */
    15631596        if (!(ac97->flags & AC97_HAS_NO_REC_GAIN)) {
    1564                 if ((err = snd_ctl_add(card, snd_ac97_cnew(&snd_ac97_control_capture_src, ac97))) < 0)
     1597                err = snd_ctl_add(card, snd_ac97_cnew(&snd_ac97_control_capture_src, ac97));
     1598                if (err < 0)
    15651599                        return err;
    15661600                if (snd_ac97_try_bit(ac97, AC97_REC_GAIN, 15)) {
     
    15701604                                return err;
    15711605                }
    1572                 if ((err = snd_ctl_add(card, kctl = snd_ac97_cnew(&snd_ac97_control_capture_vol, ac97))) < 0)
     1606                kctl = snd_ac97_cnew(&snd_ac97_control_capture_vol, ac97);
     1607                err = snd_ctl_add(card, kctl);
     1608                if (err < 0)
    15731609                        return err;
    15741610                set_tlv_db_scale(kctl, db_scale_rec_gain);
     
    15781614        /* build MIC Capture controls */
    15791615        if (snd_ac97_try_volume_mix(ac97, AC97_REC_GAIN_MIC)) {
    1580                 for (idx = 0; idx < 2; idx++)
    1581                         if ((err = snd_ctl_add(card, kctl = snd_ac97_cnew(&snd_ac97_controls_mic_capture[idx], ac97))) < 0)
     1616                for (idx = 0; idx < 2; idx++) {
     1617                        kctl = snd_ac97_cnew(&snd_ac97_controls_mic_capture[idx], ac97);
     1618                        err = snd_ctl_add(card, kctl);
     1619                        if (err < 0)
    15821620                                return err;
     1621                }
    15831622                set_tlv_db_scale(kctl, db_scale_rec_gain);
    15841623                snd_ac97_write_cache(ac97, AC97_REC_GAIN_MIC, 0x0000);
     
    15871626        /* build PCM out path & mute control */
    15881627        if (snd_ac97_try_bit(ac97, AC97_GENERAL_PURPOSE, 15)) {
    1589                 if ((err = snd_ctl_add(card, snd_ac97_cnew(&snd_ac97_controls_general[AC97_GENERAL_PCM_OUT], ac97))) < 0)
     1628                err = snd_ctl_add(card, snd_ac97_cnew(&snd_ac97_controls_general[AC97_GENERAL_PCM_OUT], ac97));
     1629                if (err < 0)
    15901630                        return err;
    15911631        }
     
    15931633        /* build Simulated Stereo Enhancement control */
    15941634        if (ac97->caps & AC97_BC_SIM_STEREO) {
    1595                 if ((err = snd_ctl_add(card, snd_ac97_cnew(&snd_ac97_controls_general[AC97_GENERAL_STEREO_ENHANCEMENT], ac97))) < 0)
     1635                err = snd_ctl_add(card, snd_ac97_cnew(&snd_ac97_controls_general[AC97_GENERAL_STEREO_ENHANCEMENT], ac97));
     1636                if (err < 0)
    15961637                        return err;
    15971638        }
     
    15991640        /* build 3D Stereo Enhancement control */
    16001641        if (snd_ac97_try_bit(ac97, AC97_GENERAL_PURPOSE, 13)) {
    1601                 if ((err = snd_ctl_add(card, snd_ac97_cnew(&snd_ac97_controls_general[AC97_GENERAL_3D], ac97))) < 0)
     1642                err = snd_ctl_add(card, snd_ac97_cnew(&snd_ac97_controls_general[AC97_GENERAL_3D], ac97));
     1643                if (err < 0)
    16021644                        return err;
    16031645        }
     
    16051647        /* build Loudness control */
    16061648        if (ac97->caps & AC97_BC_LOUDNESS) {
    1607                 if ((err = snd_ctl_add(card, snd_ac97_cnew(&snd_ac97_controls_general[AC97_GENERAL_LOUDNESS], ac97))) < 0)
     1649                err = snd_ctl_add(card, snd_ac97_cnew(&snd_ac97_controls_general[AC97_GENERAL_LOUDNESS], ac97));
     1650                if (err < 0)
    16081651                        return err;
    16091652        }
     
    16111654        /* build Mono output select control */
    16121655        if (snd_ac97_try_bit(ac97, AC97_GENERAL_PURPOSE, 9)) {
    1613                 if ((err = snd_ctl_add(card, snd_ac97_cnew(&snd_ac97_controls_general[AC97_GENERAL_MONO], ac97))) < 0)
     1656                err = snd_ctl_add(card, snd_ac97_cnew(&snd_ac97_controls_general[AC97_GENERAL_MONO], ac97));
     1657                if (err < 0)
    16141658                        return err;
    16151659        }
     
    16171661        /* build Mic select control */
    16181662        if (snd_ac97_try_bit(ac97, AC97_GENERAL_PURPOSE, 8)) {
    1619                 if ((err = snd_ctl_add(card, snd_ac97_cnew(&snd_ac97_controls_general[AC97_GENERAL_MIC], ac97))) < 0)
     1663                err = snd_ctl_add(card, snd_ac97_cnew(&snd_ac97_controls_general[AC97_GENERAL_MIC], ac97));
     1664                if (err < 0)
    16201665                        return err;
    16211666        }
     
    16231668        /* build ADC/DAC loopback control */
    16241669        if (enable_loopback && snd_ac97_try_bit(ac97, AC97_GENERAL_PURPOSE, 7)) {
    1625                 if ((err = snd_ctl_add(card, snd_ac97_cnew(&snd_ac97_controls_general[AC97_GENERAL_LOOPBACK], ac97))) < 0)
     1670                err = snd_ctl_add(card, snd_ac97_cnew(&snd_ac97_controls_general[AC97_GENERAL_LOOPBACK], ac97));
     1671                if (err < 0)
    16261672                        return err;
    16271673        }
     
    16391685                        val = snd_ac97_read(ac97, AC97_3D_CONTROL);
    16401686                        val = val == 0x0606;
    1641                         if ((err = snd_ctl_add(card, kctl = snd_ac97_cnew(&snd_ac97_controls_3d[0], ac97))) < 0)
     1687                        kctl = snd_ac97_cnew(&snd_ac97_controls_3d[0], ac97);
     1688                        err = snd_ctl_add(card, kctl);
     1689                        if (err < 0)
    16421690                                return err;
    16431691                        if (val)
    16441692                                kctl->private_value = AC97_3D_CONTROL | (9 << 8) | (7 << 16);
    1645                         if ((err = snd_ctl_add(card, kctl = snd_ac97_cnew(&snd_ac97_controls_3d[1], ac97))) < 0)
     1693                        kctl = snd_ac97_cnew(&snd_ac97_controls_3d[1], ac97);
     1694                        err = snd_ctl_add(card, kctl);
     1695                        if (err < 0)
    16461696                                return err;
    16471697                        if (val)
     
    16601710        if ((ac97->ext_id & AC97_EI_SPDIF) && !(ac97->scaps & AC97_SCAP_NO_SPDIF)) {
    16611711                if (ac97->build_ops->build_spdif) {
    1662                         if ((err = ac97->build_ops->build_spdif(ac97)) < 0)
     1712                        err = ac97->build_ops->build_spdif(ac97);
     1713                        if (err < 0)
    16631714                                return err;
    16641715                } else {
    1665                         for (idx = 0; idx < 5; idx++)
    1666                                 if ((err = snd_ctl_add(card, snd_ac97_cnew(&snd_ac97_controls_spdif[idx], ac97))) < 0)
     1716                        for (idx = 0; idx < 5; idx++) {
     1717                                err = snd_ctl_add(card, snd_ac97_cnew(&snd_ac97_controls_spdif[idx], ac97));
     1718                                if (err < 0)
    16671719                                        return err;
     1720                        }
    16681721                        if (ac97->build_ops->build_post_spdif) {
    1669                                 if ((err = ac97->build_ops->build_post_spdif(ac97)) < 0)
     1722                                err = ac97->build_ops->build_post_spdif(ac97);
     1723                                if (err < 0)
    16701724                                        return err;
    16711725                        }
     
    16791733       
    16801734        /* build chip specific controls */
    1681         if (ac97->build_ops->build_specific)
    1682                 if ((err = ac97->build_ops->build_specific(ac97)) < 0)
     1735        if (ac97->build_ops->build_specific) {
     1736                err = ac97->build_ops->build_specific(ac97);
     1737                if (err < 0)
    16831738                        return err;
     1739        }
    16841740
    16851741        if (snd_ac97_try_bit(ac97, AC97_POWERDOWN, 15)) {
     
    16891745                if (ac97->scaps & AC97_SCAP_INV_EAPD)
    16901746                        set_inv_eapd(ac97, kctl);
    1691                 if ((err = snd_ctl_add(card, kctl)) < 0)
     1747                err = snd_ctl_add(card, kctl);
     1748                if (err < 0)
    16921749                        return err;
    16931750        }
     
    17111768
    17121769        /* build modem switches */
    1713         for (idx = 0; idx < ARRAY_SIZE(snd_ac97_controls_modem_switches); idx++)
    1714                 if ((err = snd_ctl_add(card, snd_ctl_new1(&snd_ac97_controls_modem_switches[idx], ac97))) < 0)
     1770        for (idx = 0; idx < ARRAY_SIZE(snd_ac97_controls_modem_switches); idx++) {
     1771                err = snd_ctl_add(card, snd_ctl_new1(&snd_ac97_controls_modem_switches[idx], ac97));
     1772                if (err < 0)
    17151773                        return err;
     1774        }
    17161775
    17171776        /* build chip specific controls */
    1718         if (ac97->build_ops->build_specific)
    1719                 if ((err = ac97->build_ops->build_specific(ac97)) < 0)
     1777        if (ac97->build_ops->build_specific) {
     1778                err = ac97->build_ops->build_specific(ac97);
     1779                if (err < 0)
    17201780                        return err;
     1781        }
    17211782
    17221783        return 0;
     
    19632024        spin_lock_init(&bus->bus_lock);
    19642025        snd_ac97_bus_proc_init(bus);
    1965         if ((err = snd_device_new(card, SNDRV_DEV_BUS, bus, &dev_ops)) < 0) {
     2026        err = snd_device_new(card, SNDRV_DEV_BUS, bus, &dev_ops);
     2027        if (err < 0) {
    19662028                snd_ac97_bus_free(bus);
    19672029                return err;
     
    19922054                     ac97->bus->card->number, ac97->num,
    19932055                     snd_ac97_get_short_name(ac97));
    1994         if ((err = device_register(&ac97->dev)) < 0) {
     2056        err = device_register(&ac97->dev);
     2057        if (err < 0) {
    19952058                ac97_err(ac97, "Can't register ac97 bus\n");
    19962059                ac97->dev.bus = NULL;
     
    21472210                /* test if we can write to the record gain volume register */
    21482211                snd_ac97_write_cache(ac97, AC97_REC_GAIN, 0x8a06);
    2149                 if (((err = snd_ac97_read(ac97, AC97_REC_GAIN)) & 0x7fff) == 0x0a06)
     2212                err = snd_ac97_read(ac97, AC97_REC_GAIN);
     2213                if ((err & 0x7fff) == 0x0a06)
    21502214                        ac97->scaps |= AC97_SCAP_AUDIO;
    21512215        }
     
    23002364                }
    23012365                sprintf(comp, "AC97a:%08x", ac97->id);
    2302                 if ((err = snd_component_add(card, comp)) < 0) {
     2366                err = snd_component_add(card, comp);
     2367                if (err < 0) {
    23032368                        snd_ac97_free(ac97);
    23042369                        return err;
     
    23202385                }
    23212386                sprintf(comp, "AC97m:%08x", ac97->id);
    2322                 if ((err = snd_component_add(card, comp)) < 0) {
     2387                err = snd_component_add(card, comp);
     2388                if (err < 0) {
    23232389                        snd_ac97_free(ac97);
    23242390                        return err;
     
    23322398                update_power_regs(ac97);
    23332399        snd_ac97_proc_init(ac97);
    2334         if ((err = snd_device_new(card, SNDRV_DEV_CODEC, ac97, &ops)) < 0) {
     2400        err = snd_device_new(card, SNDRV_DEV_CODEC, ac97, &ops);
     2401        if (err < 0) {
    23352402                snd_ac97_free(ac97);
    23362403                return err;
  • GPL/trunk/alsa-kernel/pci/ac97/ac97_patch.c

    r679 r703  
    3030        int idx, err;
    3131
    32         for (idx = 0; idx < count; idx++)
    33                 if ((err = snd_ctl_add(ac97->bus->card, snd_ac97_cnew(&controls[idx], ac97))) < 0)
     32        for (idx = 0; idx < count; idx++) {
     33                err = snd_ctl_add(ac97->bus->card, snd_ac97_cnew(&controls[idx], ac97));
     34                if (err < 0)
    3435                        return err;
     36        }
    3537        return 0;
    3638}
     
    417419        int err;
    418420
    419         if ((err = patch_build_controls(ac97, snd_ac97_ymf753_controls_spdif, ARRAY_SIZE(snd_ac97_ymf753_controls_spdif))) < 0)
     421        err = patch_build_controls(ac97, snd_ac97_ymf753_controls_spdif, ARRAY_SIZE(snd_ac97_ymf753_controls_spdif));
     422        if (err < 0)
    420423                return err;
    421424        return 0;
     
    462465       
    463466        for (i = 0; i < ARRAY_SIZE(wm97xx_snd_ac97_controls); i++) {
    464                 if ((err = snd_ctl_add(ac97->bus->card, snd_ac97_cnew(&wm97xx_snd_ac97_controls[i], ac97))) < 0)
     467                err = snd_ctl_add(ac97->bus->card, snd_ac97_cnew(&wm97xx_snd_ac97_controls[i], ac97));
     468                if (err < 0)
    465469                        return err;
    466470        }
     
    492496        int err, i;
    493497        for (i = 0; i < ARRAY_SIZE(wm9704_snd_ac97_controls); i++) {
    494                 if ((err = snd_ctl_add(ac97->bus->card, snd_ac97_cnew(&wm9704_snd_ac97_controls[i], ac97))) < 0)
     498                err = snd_ctl_add(ac97->bus->card, snd_ac97_cnew(&wm9704_snd_ac97_controls[i], ac97));
     499                if (err < 0)
    495500                        return err;
    496501        }
     
    632637       
    633638        for (i = 0; i < ARRAY_SIZE(wm9711_snd_ac97_controls); i++) {
    634                 if ((err = snd_ctl_add(ac97->bus->card, snd_ac97_cnew(&wm9711_snd_ac97_controls[i], ac97))) < 0)
     639                err = snd_ctl_add(ac97->bus->card, snd_ac97_cnew(&wm9711_snd_ac97_controls[i], ac97));
     640                if (err < 0)
    635641                        return err;
    636642        }
     
    799805   
    800806        for (i = 0; i < ARRAY_SIZE(wm13_snd_ac97_controls_3d); i++) {
    801                 if ((err = snd_ctl_add(ac97->bus->card, snd_ac97_cnew(&wm13_snd_ac97_controls_3d[i], ac97))) < 0)
     807                err = snd_ctl_add(ac97->bus->card, snd_ac97_cnew(&wm13_snd_ac97_controls_3d[i], ac97));
     808                if (err < 0)
    802809                        return err;
    803810        }
     
    810817       
    811818        for (i = 0; i < ARRAY_SIZE(wm13_snd_ac97_controls); i++) {
    812                 if ((err = snd_ctl_add(ac97->bus->card, snd_ac97_cnew(&wm13_snd_ac97_controls[i], ac97))) < 0)
     819                err = snd_ctl_add(ac97->bus->card, snd_ac97_cnew(&wm13_snd_ac97_controls[i], ac97));
     820                if (err < 0)
    813821                        return err;
    814822        }
     
    884892        int err;
    885893
    886         if ((err = snd_ctl_add(ac97->bus->card, kctl = snd_ac97_cnew(&snd_ac97_controls_3d[0], ac97))) < 0)
     894        err = snd_ctl_add(ac97->bus->card, kctl = snd_ac97_cnew(&snd_ac97_controls_3d[0], ac97));
     895        if (err < 0)
    887896                return err;
    888897        strcpy(kctl->id.name, "3D Control Sigmatel - Depth");
     
    897906        int err;
    898907
    899         if ((err = snd_ctl_add(ac97->bus->card, kctl = snd_ac97_cnew(&snd_ac97_controls_3d[0], ac97))) < 0)
     908        kctl = snd_ac97_cnew(&snd_ac97_controls_3d[0], ac97);
     909        err = snd_ctl_add(ac97->bus->card, kctl);
     910        if (err < 0)
    900911                return err;
    901912        strcpy(kctl->id.name, "3D Control Sigmatel - Depth");
    902913        kctl->private_value = AC97_SINGLE_VALUE(AC97_3D_CONTROL, 0, 3, 0);
    903         if ((err = snd_ctl_add(ac97->bus->card, kctl = snd_ac97_cnew(&snd_ac97_controls_3d[0], ac97))) < 0)
     914        kctl = snd_ac97_cnew(&snd_ac97_controls_3d[0], ac97);
     915        err = snd_ctl_add(ac97->bus->card, kctl);
     916        if (err < 0)
    904917                return err;
    905918        strcpy(kctl->id.name, "3D Control Sigmatel - Rear Depth");
     
    928941
    929942        snd_ac97_write_cache(ac97, AC97_SIGMATEL_ANALOG, snd_ac97_read(ac97, AC97_SIGMATEL_ANALOG) & ~0x0003);
    930         if (snd_ac97_try_bit(ac97, AC97_SIGMATEL_ANALOG, 1))
    931                 if ((err = patch_build_controls(ac97, &snd_ac97_sigmatel_controls[0], 1)) < 0)
     943        if (snd_ac97_try_bit(ac97, AC97_SIGMATEL_ANALOG, 1)) {
     944                err = patch_build_controls(ac97, &snd_ac97_sigmatel_controls[0], 1);
     945                if (err < 0)
    932946                        return err;
    933         if (snd_ac97_try_bit(ac97, AC97_SIGMATEL_ANALOG, 0))
    934                 if ((err = patch_build_controls(ac97, &snd_ac97_sigmatel_controls[1], 1)) < 0)
     947        }
     948        if (snd_ac97_try_bit(ac97, AC97_SIGMATEL_ANALOG, 0)) {
     949                err = patch_build_controls(ac97, &snd_ac97_sigmatel_controls[1], 1);
     950                if (err < 0)
    935951                        return err;
    936         if (snd_ac97_try_bit(ac97, AC97_SIGMATEL_DAC2INVERT, 2))
    937                 if ((err = patch_build_controls(ac97, &snd_ac97_sigmatel_4speaker, 1)) < 0)
     952        }
     953        if (snd_ac97_try_bit(ac97, AC97_SIGMATEL_DAC2INVERT, 2)) {
     954                err = patch_build_controls(ac97, &snd_ac97_sigmatel_4speaker, 1);
     955                if (err < 0)
    938956                        return err;
    939         if (snd_ac97_try_bit(ac97, AC97_SIGMATEL_DAC2INVERT, 3))
    940                 if ((err = patch_build_controls(ac97, &snd_ac97_sigmatel_phaseinvert, 1)) < 0)
     957        }
     958        if (snd_ac97_try_bit(ac97, AC97_SIGMATEL_DAC2INVERT, 3)) {
     959                err = patch_build_controls(ac97, &snd_ac97_sigmatel_phaseinvert, 1);
     960                if (err < 0)
    941961                        return err;
     962        }
    942963        return 0;
    943964}
     
    9851006
    9861007        snd_ac97_rename_vol_ctl(ac97, "Headphone Playback", "Sigmatel Surround Playback");
    987         if ((err = patch_build_controls(ac97, &snd_ac97_stac9708_bias_control, 1)) < 0)
     1008        err = patch_build_controls(ac97, &snd_ac97_stac9708_bias_control, 1);
     1009        if (err < 0)
    9881010                return err;
    9891011        return patch_sigmatel_stac97xx_specific(ac97);
     
    12631285
    12641286        /* con mask, pro mask, default */
    1265         if ((err = patch_build_controls(ac97, &snd_ac97_controls_spdif[0], 3)) < 0)
     1287        err = patch_build_controls(ac97, &snd_ac97_controls_spdif[0], 3);
     1288        if (err < 0)
    12661289                return err;
    12671290        /* switch, spsa */
    1268         if ((err = patch_build_controls(ac97, &snd_ac97_cirrus_controls_spdif[0], 1)) < 0)
     1291        err = patch_build_controls(ac97, &snd_ac97_cirrus_controls_spdif[0], 1);
     1292        if (err < 0)
    12691293                return err;
    12701294        switch (ac97->id & AC97_ID_CS_MASK) {
    12711295        case AC97_ID_CS4205:
    1272                 if ((err = patch_build_controls(ac97, &snd_ac97_cirrus_controls_spdif[1], 1)) < 0)
     1296                err = patch_build_controls(ac97, &snd_ac97_cirrus_controls_spdif[1], 1);
     1297                if (err < 0)
    12731298                        return err;
    12741299                break;
     
    13251350
    13261351        /* con mask, pro mask, default */
    1327         if ((err = patch_build_controls(ac97, &snd_ac97_controls_spdif[0], 3)) < 0)
     1352        err = patch_build_controls(ac97, &snd_ac97_controls_spdif[0], 3);
     1353        if (err < 0)
    13281354                return err;
    13291355        /* switch */
    1330         if ((err = patch_build_controls(ac97, &snd_ac97_conexant_controls_spdif[0], 1)) < 0)
     1356        err = patch_build_controls(ac97, &snd_ac97_conexant_controls_spdif[0], 1);
     1357        if (err < 0)
    13311358                return err;
    13321359        /* set default PCM S/PDIF params */
     
    15931620        int err;
    15941621
    1595         if ((err = patch_build_controls(ac97, snd_ac97_controls_ad1885, ARRAY_SIZE(snd_ac97_controls_ad1885))) < 0)
     1622        err = patch_build_controls(ac97, snd_ac97_controls_ad1885, ARRAY_SIZE(snd_ac97_controls_ad1885));
     1623        if (err < 0)
    15961624                return err;
    15971625        reset_tlv(ac97, "Headphone Playback Volume",
     
    18761904        int err;
    18771905
    1878         if ((err = patch_build_controls(ac97, &snd_ac97_ad198x_2cmic, 1)) < 0)
     1906        err = patch_build_controls(ac97, &snd_ac97_ad198x_2cmic, 1);
     1907        if (err < 0)
    18791908                return err;
    18801909        if (check_list(ac97, ad1981_jacks_denylist))
     
    20612090        int err;
    20622091
    2063         if ((err = patch_ad1888_specific(ac97)) < 0)
     2092        err = patch_ad1888_specific(ac97);
     2093        if (err < 0)
    20642094                return err;
    20652095        return patch_build_controls(ac97, &snd_ac97_ad198x_2cmic, 1);
     
    21692199        snd_ac97_rename_vol_ctl(ac97, "Headphone Playback", "Master Playback");
    21702200
    2171         if ((err = patch_build_controls(ac97, &snd_ac97_ad198x_2cmic, 1)) < 0)
     2201        err = patch_build_controls(ac97, &snd_ac97_ad198x_2cmic, 1);
     2202        if (err < 0)
    21722203                return err;
    21732204
     
    24612492        int err;
    24622493
    2463         if ((err = patch_build_controls(ac97, &snd_ac97_ad198x_2cmic, 1)) < 0)
     2494        err = patch_build_controls(ac97, &snd_ac97_ad198x_2cmic, 1);
     2495        if (err < 0)
    24642496                return err;
    24652497
     
    25832615        int err;
    25842616
    2585         if ((err = patch_build_controls(ac97, snd_ac97_controls_alc650, ARRAY_SIZE(snd_ac97_controls_alc650))) < 0)
     2617        err = patch_build_controls(ac97, snd_ac97_controls_alc650, ARRAY_SIZE(snd_ac97_controls_alc650));
     2618        if (err < 0)
    25862619                return err;
    25872620        if (ac97->ext_id & AC97_EI_SPDIF) {
    2588                 if ((err = patch_build_controls(ac97, snd_ac97_spdif_controls_alc650, ARRAY_SIZE(snd_ac97_spdif_controls_alc650))) < 0)
     2621                err = patch_build_controls(ac97, snd_ac97_spdif_controls_alc650, ARRAY_SIZE(snd_ac97_spdif_controls_alc650));
     2622                if (err < 0)
    25892623                        return err;
    25902624        }
     
    27362770        int err;
    27372771
    2738         if ((err = patch_build_controls(ac97, snd_ac97_controls_alc655, ARRAY_SIZE(snd_ac97_controls_alc655))) < 0)
     2772        err = patch_build_controls(ac97, snd_ac97_controls_alc655, ARRAY_SIZE(snd_ac97_controls_alc655));
     2773        if (err < 0)
    27392774                return err;
    27402775        if (ac97->ext_id & AC97_EI_SPDIF) {
    2741                 if ((err = patch_build_controls(ac97, snd_ac97_spdif_controls_alc655, ARRAY_SIZE(snd_ac97_spdif_controls_alc655))) < 0)
     2776                err = patch_build_controls(ac97, snd_ac97_spdif_controls_alc655, ARRAY_SIZE(snd_ac97_spdif_controls_alc655));
     2777                if (err < 0)
    27422778                        return err;
    27432779        }
     
    28482884        int err;
    28492885
    2850         if ((err = patch_build_controls(ac97, snd_ac97_controls_alc850, ARRAY_SIZE(snd_ac97_controls_alc850))) < 0)
     2886        err = patch_build_controls(ac97, snd_ac97_controls_alc850, ARRAY_SIZE(snd_ac97_controls_alc850));
     2887        if (err < 0)
    28512888                return err;
    28522889        if (ac97->ext_id & AC97_EI_SPDIF) {
    2853                 if ((err = patch_build_controls(ac97, snd_ac97_spdif_controls_alc655, ARRAY_SIZE(snd_ac97_spdif_controls_alc655))) < 0)
     2890                err = patch_build_controls(ac97, snd_ac97_spdif_controls_alc655, ARRAY_SIZE(snd_ac97_spdif_controls_alc655));
     2891                if (err < 0)
    28542892                        return err;
    28552893        }
     
    34383476        int err;
    34393477
    3440         if (snd_ac97_try_bit(ac97, 0x5a, 9))
    3441                 if ((err = patch_build_controls(ac97, &snd_ac97_controls_vt1616[0], 1)) < 0)
     3478        if (snd_ac97_try_bit(ac97, 0x5a, 9)) {
     3479                err = patch_build_controls(ac97, &snd_ac97_controls_vt1616[0], 1);
     3480                if (err < 0)
    34423481                        return err;
    3443         if ((err = patch_build_controls(ac97, &snd_ac97_controls_vt1616[1], ARRAY_SIZE(snd_ac97_controls_vt1616) - 1)) < 0)
     3482        }
     3483        err = patch_build_controls(ac97, &snd_ac97_controls_vt1616[1], ARRAY_SIZE(snd_ac97_controls_vt1616) - 1);
     3484        if (err < 0)
    34443485                return err;
    34453486
     
    38113852{
    38123853        int err;
    3813         if ((err = patch_build_controls(ac97, snd_ac97_controls_it2646, ARRAY_SIZE(snd_ac97_controls_it2646))) < 0)
     3854        err = patch_build_controls(ac97, snd_ac97_controls_it2646, ARRAY_SIZE(snd_ac97_controls_it2646));
     3855        if (err < 0)
    38143856                return err;
    3815         if ((err = patch_build_controls(ac97, snd_ac97_spdif_controls_it2646, ARRAY_SIZE(snd_ac97_spdif_controls_it2646))) < 0)
     3857        err = patch_build_controls(ac97, snd_ac97_spdif_controls_it2646, ARRAY_SIZE(snd_ac97_spdif_controls_it2646));
     3858        if (err < 0)
    38163859                return err;
    38173860        return 0;
     
    38463889{
    38473890        int idx, err;
    3848         for (idx = 0; idx < ARRAY_SIZE(snd_ac97_controls_si3036); idx++)
    3849                 if ((err = snd_ctl_add(ac97->bus->card, snd_ctl_new1(&snd_ac97_controls_si3036[idx], ac97))) < 0)
     3891        for (idx = 0; idx < ARRAY_SIZE(snd_ac97_controls_si3036); idx++) {
     3892                err = snd_ctl_add(ac97->bus->card, snd_ctl_new1(&snd_ac97_controls_si3036[idx], ac97));
     3893                if (err < 0)
    38503894                        return err;
     3895        }
    38513896        return 0;
    38523897}
     
    39133958{
    39143959        int idx, err;
    3915         for (idx = 0; idx < ARRAY_SIZE(snd_ac97_controls_ucb1400); idx++)
    3916                 if ((err = snd_ctl_add(ac97->bus->card, snd_ctl_new1(&snd_ac97_controls_ucb1400[idx], ac97))) < 0)
     3960        for (idx = 0; idx < ARRAY_SIZE(snd_ac97_controls_ucb1400); idx++) {
     3961                err = snd_ctl_add(ac97->bus->card, snd_ctl_new1(&snd_ac97_controls_ucb1400[idx], ac97));
     3962                if (err < 0)
    39173963                        return err;
     3964        }
    39183965        return 0;
    39193966}
Note: See TracChangeset for help on using the changeset viewer.