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:
69 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}
  • GPL/trunk/alsa-kernel/pci/ad1889.c

    r695 r703  
    853853        *rchip = NULL;
    854854
    855         if ((err = pci_enable_device(pci)) < 0)
     855        err = pci_enable_device(pci);
     856        if (err < 0)
    856857                return err;
    857858
     
    864865
    865866        /* allocate chip specific data with zero-filled memory */
    866         if ((chip = kzalloc(sizeof(*chip), GFP_KERNEL)) == NULL) {
     867        chip = kzalloc(sizeof(*chip), GFP_KERNEL);
     868        if (!chip) {
    867869                pci_disable_device(pci);
    868870                return -ENOMEM;
     
    875877
    876878        /* (1) PCI resource allocation */
    877         if ((err = pci_request_regions(pci, card->driver)) < 0)
     879        err = pci_request_regions(pci, card->driver);
     880        if (err < 0)
    878881                goto free_and_ret;
    879882
     
    901904
    902905        /* (2) initialization of the chip hardware */
    903         if ((err = snd_ad1889_init(chip)) < 0) {
     906        err = snd_ad1889_init(chip);
     907        if (err < 0) {
    904908                snd_ad1889_free(chip);
    905909                return err;
    906910        }
    907911
    908         if ((err = snd_device_new(card, SNDRV_DEV_LOWLEVEL, chip, &ops)) < 0) {
     912        err = snd_device_new(card, SNDRV_DEV_LOWLEVEL, chip, &ops);
     913        if (err < 0) {
    909914                snd_ad1889_free(chip);
    910915                return err;
  • GPL/trunk/alsa-kernel/pci/ak4531_codec.c

    r679 r703  
    385385        *ak4531 = *_ak4531;
    386386        mutex_init(&ak4531->reg_mutex);
    387         if ((err = snd_component_add(card, "AK4531")) < 0) {
     387        err = snd_component_add(card, "AK4531");
     388        if (err < 0) {
    388389                snd_ak4531_free(ak4531);
    389390                return err;
     
    399400        }
    400401        for (idx = 0; idx < ARRAY_SIZE(snd_ak4531_controls); idx++) {
    401                 if ((err = snd_ctl_add(card, snd_ctl_new1(&snd_ak4531_controls[idx], ak4531))) < 0) {
     402                err = snd_ctl_add(card, snd_ctl_new1(&snd_ak4531_controls[idx], ak4531));
     403                if (err < 0) {
    402404                        snd_ak4531_free(ak4531);
    403405                        return err;
     
    405407        }
    406408        snd_ak4531_proc_init(card, ak4531);
    407         if ((err = snd_device_new(card, SNDRV_DEV_CODEC, ak4531, &ops)) < 0) {
     409        err = snd_device_new(card, SNDRV_DEV_CODEC, ak4531, &ops);
     410        if (err < 0) {
    408411                snd_ak4531_free(ak4531);
    409412                return err;
  • GPL/trunk/alsa-kernel/pci/als300.c

    r695 r703  
    299299        };
    300300
    301         if ((err = snd_ac97_bus(chip->card, 0, &ops, NULL, &bus)) < 0)
     301        err = snd_ac97_bus(chip->card, 0, &ops, NULL, &bus);
     302        if (err < 0)
    302303                return err;
    303304
     
    622623        *rchip = NULL;
    623624
    624         if ((err = pci_enable_device(pci)) < 0)
     625        err = pci_enable_device(pci);
     626        if (err < 0)
    625627                return err;
    626628
     
    644646        spin_lock_init(&chip->reg_lock);
    645647
    646         if ((err = pci_request_regions(pci, "ALS300")) < 0) {
     648        err = pci_request_regions(pci, "ALS300");
     649        if (err < 0) {
    647650                kfree(chip);
    648651                pci_disable_device(pci);
     
    674677        }
    675678
    676         if ((err = snd_als300_new_pcm(chip)) < 0) {
     679        err = snd_als300_new_pcm(chip);
     680        if (err < 0) {
    677681                dev_err(card->dev, "Could not create PCM\n");
    678682                snd_als300_free(chip);
     
    680684        }
    681685
    682         if ((err = snd_device_new(card, SNDRV_DEV_LOWLEVEL,
    683                                                 chip, &ops)) < 0) {
     686        err = snd_device_new(card, SNDRV_DEV_LOWLEVEL, chip, &ops);
     687        if (err < 0) {
    684688                snd_als300_free(chip);
    685689                return err;
     
    742746        chip_type = pci_id->driver_data;
    743747
    744         if ((err = snd_als300_create(card, pci, chip_type, &chip)) < 0) {
     748        err = snd_als300_create(card, pci, chip_type, &chip);
     749        if (err < 0) {
    745750                snd_card_free(card);
    746751                return err;
     
    759764                                card->shortname, chip->port, chip->irq);
    760765
    761         if ((err = snd_card_register(card)) < 0) {
     766        err = snd_card_register(card);
     767        if (err < 0) {
    762768                snd_card_free(card);
    763769                return err;
  • GPL/trunk/alsa-kernel/pci/als4000.c

    r695 r703  
    836836
    837837        /* enable PCI device */
    838         if ((err = pci_enable_device(pci)) < 0) {
     838        err = pci_enable_device(pci);
     839        if (err < 0)
    839840                return err;
    840         }
     841
    841842        /* check, if we can restrict PCI DMA transfers to 24 bits */
    842843        if (dma_set_mask_and_coherent(&pci->dev, DMA_BIT_MASK(24))) {
     
    846847        }
    847848
    848         if ((err = pci_request_regions(pci, "ALS4000")) < 0) {
     849        err = pci_request_regions(pci, "ALS4000");
     850        if (err < 0) {
    849851                pci_disable_device(pci);
    850852                return err;
     
    873875        snd_als4000_set_addr(acard->iobase, 0, 0, 0, 0);
    874876
    875         if ((err = snd_sbdsp_create(card,
    876                                     iobase + ALS4K_IOB_10_ADLIB_ADDR0,
    877                                     pci->irq,
     877        err = snd_sbdsp_create(card,
     878                               iobase + ALS4K_IOB_10_ADLIB_ADDR0,
     879                               pci->irq,
    878880                /* internally registered as IRQF_SHARED in case of ALS4000 SB */
    879                                     snd_als4000_interrupt,
    880                                     -1,
    881                                     -1,
    882                                     SB_HW_ALS4000,
    883                                     &chip)) < 0) {
     881                               snd_als4000_interrupt,
     882                               -1,
     883                               -1,
     884                               SB_HW_ALS4000,
     885                               &chip);
     886        if (err < 0)
    884887                goto out_err;
    885         }
    886888        acard->chip = chip;
    887889
     
    896898                card->shortname, chip->alt_port, chip->irq);
    897899
    898         if ((err = snd_mpu401_uart_new( card, 0, MPU401_HW_ALS4000,
    899                                         iobase + ALS4K_IOB_30_MIDI_DATA,
    900                                         MPU401_INFO_INTEGRATED |
    901                                         MPU401_INFO_IRQ_HOOK,
    902                                         -1, &chip->rmidi)) < 0) {
     900        err = snd_mpu401_uart_new(card, 0, MPU401_HW_ALS4000,
     901                                  iobase + ALS4K_IOB_30_MIDI_DATA,
     902                                  MPU401_INFO_INTEGRATED |
     903                                  MPU401_INFO_IRQ_HOOK,
     904                                  -1, &chip->rmidi);
     905        if (err < 0) {
    903906                dev_err(&pci->dev, "no MPU-401 device at 0x%lx?\n",
    904907                                iobase + ALS4K_IOB_30_MIDI_DATA);
     
    911914         * SPECS_PAGE: 21 */
    912915
    913         if ((err = snd_als4000_pcm(chip, 0)) < 0) {
     916        err = snd_als4000_pcm(chip, 0);
     917        if (err < 0)
    914918                goto out_err;
    915         }
    916         if ((err = snd_sbmixer_new(chip)) < 0) {
     919
     920        err = snd_sbmixer_new(chip);
     921        if (err < 0)
    917922                goto out_err;
    918         }           
    919923
    920924        if (snd_opl3_create(card,
     
    926930                           iobase + ALS4K_IOB_12_ADLIB_ADDR2);
    927931        } else {
    928                 if ((err = snd_opl3_hwdep_new(opl3, 0, 1, NULL)) < 0) {
     932                err = snd_opl3_hwdep_new(opl3, 0, 1, NULL);
     933                if (err < 0)
    929934                        goto out_err;
    930                 }
    931935        }
    932936
    933937        snd_als4000_create_gameport(acard, dev);
    934938
    935         if ((err = snd_card_register(card)) < 0) {
     939        err = snd_card_register(card);
     940        if (err < 0)
    936941                goto out_err;
    937         }
     942
    938943        pci_set_drvdata(pci, card);
    939944        dev++;
  • GPL/trunk/alsa-kernel/pci/atiixp.c

    r695 r703  
    10501050                runtime->hw.formats = SNDRV_PCM_FMTBIT_IEC958_SUBFRAME_LE;
    10511051        }
    1052         if ((err = snd_pcm_hw_constraint_integer(runtime, SNDRV_PCM_HW_PARAM_PERIODS)) < 0)
     1052        err = snd_pcm_hw_constraint_integer(runtime, SNDRV_PCM_HW_PARAM_PERIODS);
     1053        if (err < 0)
    10531054                return err;
    10541055        runtime->private_data = dma;
     
    14261427                return -ENXIO;
    14271428
    1428         if ((err = snd_ac97_bus(chip->card, 0, &ops, chip, &pbus)) < 0)
     1429        err = snd_ac97_bus(chip->card, 0, &ops, chip, &pbus);
     1430        if (err < 0)
    14291431                return err;
    14301432        pbus->clock = clock;
     
    14421444                if (! chip->spdif_over_aclink)
    14431445                        ac97.scaps |= AC97_SCAP_NO_SPDIF;
    1444                 if ((err = snd_ac97_mixer(pbus, &ac97, &chip->ac97[i])) < 0) {
     1446                err = snd_ac97_mixer(pbus, &ac97, &chip->ac97[i]);
     1447                if (err < 0) {
    14451448                        chip->ac97[i] = NULL; /* to be sure */
    14461449                        dev_dbg(chip->card->dev,
     
    15731576        int err;
    15741577
    1575         if ((err = pci_enable_device(pci)) < 0)
     1578        err = pci_enable_device(pci);
     1579        if (err < 0)
    15761580                return err;
    15771581
     
    15871591        chip->pci = pci;
    15881592        chip->irq = -1;
    1589         if ((err = pci_request_regions(pci, "ATI IXP AC97")) < 0) {
     1593        err = pci_request_regions(pci, "ATI IXP AC97");
     1594        if (err < 0) {
    15901595                pci_disable_device(pci);
    15911596                kfree(chip);
     
    16101615        pci_set_master(pci);
    16111616
    1612         if ((err = snd_device_new(card, SNDRV_DEV_LOWLEVEL, chip, &ops)) < 0) {
     1617        err = snd_device_new(card, SNDRV_DEV_LOWLEVEL, chip, &ops);
     1618        if (err < 0) {
    16131619                snd_atiixp_free(chip);
    16141620                return err;
     
    16331639        strcpy(card->driver, spdif_aclink ? "ATIIXP" : "ATIIXP-SPDMA");
    16341640        strcpy(card->shortname, "ATI IXP");
    1635         if ((err = snd_atiixp_create(card, pci, &chip)) < 0)
     1641        err = snd_atiixp_create(card, pci, &chip);
     1642        if (err < 0)
    16361643                goto __error;
    16371644        card->private_data = chip;
    16381645
    1639         if ((err = snd_atiixp_aclink_reset(chip)) < 0)
     1646        err = snd_atiixp_aclink_reset(chip);
     1647        if (err < 0)
    16401648                goto __error;
    16411649
    16421650        chip->spdif_over_aclink = spdif_aclink;
    16431651
    1644         if ((err = snd_atiixp_mixer_new(chip, ac97_clock, ac97_quirk)) < 0)
     1652        err = snd_atiixp_mixer_new(chip, ac97_clock, ac97_quirk);
     1653        if (err < 0)
    16451654                goto __error;
    16461655
    1647         if ((err = snd_atiixp_pcm_new(chip)) < 0)
     1656        err = snd_atiixp_pcm_new(chip);
     1657        if (err < 0)
    16481658                goto __error;
    16491659       
     
    16621672                 chip->addr, chip->irq);
    16631673
    1664         if ((err = snd_card_register(card)) < 0)
     1674        err = snd_card_register(card);
     1675        if (err < 0)
    16651676                goto __error;
    16661677
  • GPL/trunk/alsa-kernel/pci/atiixp_modem.c

    r695 r703  
    857857        runtime->hw = snd_atiixp_pcm_hw;
    858858        dma->ac97_pcm_type = pcm_type;
    859         if ((err = snd_pcm_hw_constraint_list(runtime, 0,
    860                                               SNDRV_PCM_HW_PARAM_RATE,
    861                                               &hw_constraints_rates)) < 0)
     859        err = snd_pcm_hw_constraint_list(runtime, 0, SNDRV_PCM_HW_PARAM_RATE,
     860                                         &hw_constraints_rates);
     861        if (err < 0)
    862862                return err;
    863         if ((err = snd_pcm_hw_constraint_integer(runtime,
    864                                                  SNDRV_PCM_HW_PARAM_PERIODS)) < 0)
     863        err = snd_pcm_hw_constraint_integer(runtime, SNDRV_PCM_HW_PARAM_PERIODS);
     864        if (err < 0)
    865865                return err;
    866866        runtime->private_data = dma;
     
    10591059                return -ENXIO;
    10601060
    1061         if ((err = snd_ac97_bus(chip->card, 0, &ops, chip, &pbus)) < 0)
     1061        err = snd_ac97_bus(chip->card, 0, &ops, chip, &pbus);
     1062        if (err < 0)
    10621063                return err;
    10631064        pbus->clock = clock;
     
    10731074                ac97.num = i;
    10741075                ac97.scaps = AC97_SCAP_SKIP_AUDIO | AC97_SCAP_POWER_SAVE;
    1075                 if ((err = snd_ac97_mixer(pbus, &ac97, &chip->ac97[i])) < 0) {
     1076                err = snd_ac97_mixer(pbus, &ac97, &chip->ac97[i]);
     1077                if (err < 0) {
    10761078                        chip->ac97[i] = NULL; /* to be sure */
    10771079                        dev_dbg(chip->card->dev,
     
    11931195        int err;
    11941196
    1195         if ((err = pci_enable_device(pci)) < 0)
     1197        err = pci_enable_device(pci);
     1198        if (err < 0)
    11961199                return err;
    11971200
     
    12071210        chip->pci = pci;
    12081211        chip->irq = -1;
    1209         if ((err = pci_request_regions(pci, "ATI IXP MC97")) < 0) {
     1212        err = pci_request_regions(pci, "ATI IXP MC97");
     1213        if (err < 0) {
    12101214                kfree(chip);
    12111215                pci_disable_device(pci);
     
    12301234        pci_set_master(pci);
    12311235
    1232         if ((err = snd_device_new(card, SNDRV_DEV_LOWLEVEL, chip, &ops)) < 0) {
     1236        err = snd_device_new(card, SNDRV_DEV_LOWLEVEL, chip, &ops);
     1237        if (err < 0) {
    12331238                snd_atiixp_free(chip);
    12341239                return err;
     
    12531258        strcpy(card->driver, "ATIIXP-MODEM");
    12541259        strcpy(card->shortname, "ATI IXP Modem");
    1255         if ((err = snd_atiixp_create(card, pci, &chip)) < 0)
     1260        err = snd_atiixp_create(card, pci, &chip);
     1261        if (err < 0)
    12561262                goto __error;
    12571263        card->private_data = chip;
    12581264
    1259         if ((err = snd_atiixp_aclink_reset(chip)) < 0)
     1265        err = snd_atiixp_aclink_reset(chip);
     1266        if (err < 0)
    12601267                goto __error;
    12611268
    1262         if ((err = snd_atiixp_mixer_new(chip, ac97_clock)) < 0)
     1269        err = snd_atiixp_mixer_new(chip, ac97_clock);
     1270        if (err < 0)
    12631271                goto __error;
    12641272
    1265         if ((err = snd_atiixp_pcm_new(chip)) < 0)
     1273        err = snd_atiixp_pcm_new(chip);
     1274        if (err < 0)
    12661275                goto __error;
    12671276       
     
    12731282                card->shortname, pci->revision, chip->addr, chip->irq);
    12741283
    1275         if ((err = snd_card_register(card)) < 0)
     1284        err = snd_card_register(card);
     1285        if (err < 0)
    12761286                goto __error;
    12771287
  • GPL/trunk/alsa-kernel/pci/au88x0/au88x0.c

    r695 r703  
    4747{
    4848        int rc;
    49         if (!(rc = pci_write_config_byte(vortex, 0x40, 0xff))) {
    50                         dev_info(&vortex->dev, "vortex latency is 0xff\n");
     49        rc = pci_write_config_byte(vortex, 0x40, 0xff);
     50        if (!rc) {
     51                dev_info(&vortex->dev, "vortex latency is 0xff\n");
    5152        } else {
    5253                dev_warn(&vortex->dev,
     
    6667         */
    6768
    68         if (!(rc = pci_read_config_byte(via, 0x42, &value))
    69                         && ((value & 0x10)
    70                                 || !(rc = pci_write_config_byte(via, 0x42, value | 0x10)))) {
     69        rc = pci_read_config_byte(via, 0x42, &value);
     70        if (!rc) {
     71                if (!(value & 0x10))
     72                        rc = pci_write_config_byte(via, 0x42, value | 0x10);
     73        }
     74        if (!rc) {
    7175                dev_info(&via->dev, "bridge config is 0x%x\n", value | 0x10);
    7276        } else {
     
    103107                if (fix & 0x1)
    104108                        vortex_fix_latency(vortex);
    105                 if ((fix & 0x2) && (via = pci_get_device(PCI_VENDOR_ID_VIA,
    106                                 PCI_DEVICE_ID_VIA_8365_1, NULL)))
    107                         vortex_fix_agp_bridge(via);
    108                 if ((fix & 0x4) && (via = pci_get_device(PCI_VENDOR_ID_VIA,
    109                                 PCI_DEVICE_ID_VIA_82C598_1, NULL)))
    110                         vortex_fix_agp_bridge(via);
    111                 if ((fix & 0x8) && (via = pci_get_device(PCI_VENDOR_ID_AMD,
    112                                 PCI_DEVICE_ID_AMD_FE_GATE_7007, NULL)))
     109                if (fix & 0x2)
     110                        via = pci_get_device(PCI_VENDOR_ID_VIA,
     111                                             PCI_DEVICE_ID_VIA_8365_1, NULL);
     112                else if (fix & 0x4)
     113                        via = pci_get_device(PCI_VENDOR_ID_VIA,
     114                                             PCI_DEVICE_ID_VIA_82C598_1, NULL);
     115                else if (fix & 0x8)
     116                        via = pci_get_device(PCI_VENDOR_ID_AMD,
     117                                             PCI_DEVICE_ID_AMD_FE_GATE_7007, NULL);
     118                if (via)
    113119                        vortex_fix_agp_bridge(via);
    114120        }
     
    148154
    149155        // check PCI availability (DMA).
    150         if ((err = pci_enable_device(pci)) < 0)
     156        err = pci_enable_device(pci);
     157        if (err < 0)
    151158                return err;
    152159        if (dma_set_mask_and_coherent(&pci->dev, DMA_BIT_MASK(32))) {
     
    175182        // Get MMIO area
    176183        //
    177         if ((err = pci_request_regions(pci, CARD_NAME_SHORT)) != 0)
     184        err = pci_request_regions(pci, CARD_NAME_SHORT);
     185        if (err)
    178186                goto regions_out;
    179187
     
    188196         * This must be done before we do request_irq otherwise we can get spurious
    189197         * interrupts that we do not handle properly and make a mess of things */
    190         if ((err = vortex_core_init(chip)) != 0) {
     198        err = vortex_core_init(chip);
     199        if (err) {
    191200                dev_err(card->dev, "hw core init failed\n");
    192201                goto core_out;
    193202        }
    194203
    195         if ((err = request_irq(pci->irq, vortex_interrupt,
    196                                IRQF_SHARED, KBUILD_MODNAME,
    197                                chip)) != 0) {
     204        err = request_irq(pci->irq, vortex_interrupt,
     205                          IRQF_SHARED, KBUILD_MODNAME, chip);
     206        if (err) {
    198207                dev_err(card->dev, "cannot grab irq\n");
    199208                goto irq_out;
     
    206215
    207216        // Register alsa root device.
    208         if ((err = snd_device_new(card, SNDRV_DEV_LOWLEVEL, chip, &ops)) < 0) {
     217        err = snd_device_new(card, SNDRV_DEV_LOWLEVEL, chip, &ops);
     218        if (err < 0)
    209219                goto alloc_out;
    210         }
    211220
    212221        *rchip = chip;
     
    253262
    254263        // (3)
    255         if ((err = snd_vortex_create(card, pci, &chip)) < 0) {
     264        err = snd_vortex_create(card, pci, &chip);
     265        if (err < 0) {
    256266                snd_card_free(card);
    257267                return err;
     
    279289#ifndef CHIP_AU8820
    280290        // ADB SPDIF
    281         if ((err = snd_vortex_new_pcm(chip, VORTEX_PCM_SPDIF, 1)) < 0) {
     291        err = snd_vortex_new_pcm(chip, VORTEX_PCM_SPDIF, 1);
     292        if (err < 0) {
    282293                snd_card_free(card);
    283294                return err;
    284295        }
    285296        // A3D
    286         if ((err = snd_vortex_new_pcm(chip, VORTEX_PCM_A3D, NR_A3D)) < 0) {
     297        err = snd_vortex_new_pcm(chip, VORTEX_PCM_A3D, NR_A3D);
     298        if (err < 0) {
    287299                snd_card_free(card);
    288300                return err;
     
    298310#ifndef CHIP_AU8810
    299311        // WT pcm.
    300         if ((err = snd_vortex_new_pcm(chip, VORTEX_PCM_WT, NR_WT)) < 0) {
     312        err = snd_vortex_new_pcm(chip, VORTEX_PCM_WT, NR_WT);
     313        if (err < 0) {
    301314                snd_card_free(card);
    302315                return err;
    303316        }
    304317#endif
    305         if ((err = snd_vortex_midi(chip)) < 0) {
     318        err = snd_vortex_midi(chip);
     319        if (err < 0) {
    306320                snd_card_free(card);
    307321                return err;
     
    328342
    329343        // (5)
    330         if ((err = pci_read_config_word(pci, PCI_DEVICE_ID,
    331                                   &(chip->device))) < 0) {
     344        err = pci_read_config_word(pci, PCI_DEVICE_ID, &chip->device);
     345        if (err < 0) {
    332346                snd_card_free(card);
    333347                return err;
    334348        }       
    335         if ((err = pci_read_config_word(pci, PCI_VENDOR_ID,
    336                                   &(chip->vendor))) < 0) {
     349        err = pci_read_config_word(pci, PCI_VENDOR_ID, &chip->vendor);
     350        if (err < 0) {
    337351                snd_card_free(card);
    338352                return err;
     
    353367
    354368        // (6)
    355         if ((err = snd_card_register(card)) < 0) {
     369        err = snd_card_register(card);
     370        if (err < 0) {
    356371                snd_card_free(card);
    357372                return err;
  • GPL/trunk/alsa-kernel/pci/au88x0/au88x0_a3d.c

    r679 r703  
    850850        /* HRTF controls. */
    851851        for (i = 0; i < NR_A3D; i++) {
    852                 if ((kcontrol =
    853                      snd_ctl_new1(&vortex_a3d_kcontrol, &vortex->a3d[i])) == NULL)
     852                kcontrol = snd_ctl_new1(&vortex_a3d_kcontrol, &vortex->a3d[i]);
     853                if (!kcontrol)
    854854                        return -ENOMEM;
    855855                kcontrol->id.numid = CTRLID_HRTF;
    856856                kcontrol->info = snd_vortex_a3d_hrtf_info;
    857857                kcontrol->put = snd_vortex_a3d_hrtf_put;
    858                 if ((err = snd_ctl_add(vortex->card, kcontrol)) < 0)
     858                err = snd_ctl_add(vortex->card, kcontrol);
     859                if (err < 0)
    859860                        return err;
    860861        }
    861862        /* ITD controls. */
    862863        for (i = 0; i < NR_A3D; i++) {
    863                 if ((kcontrol =
    864                      snd_ctl_new1(&vortex_a3d_kcontrol, &vortex->a3d[i])) == NULL)
     864                kcontrol = snd_ctl_new1(&vortex_a3d_kcontrol, &vortex->a3d[i]);
     865                if (!kcontrol)
    865866                        return -ENOMEM;
    866867                kcontrol->id.numid = CTRLID_ITD;
    867868                kcontrol->info = snd_vortex_a3d_itd_info;
    868869                kcontrol->put = snd_vortex_a3d_itd_put;
    869                 if ((err = snd_ctl_add(vortex->card, kcontrol)) < 0)
     870                err = snd_ctl_add(vortex->card, kcontrol);
     871                if (err < 0)
    870872                        return err;
    871873        }
    872874        /* ILD (gains) controls. */
    873875        for (i = 0; i < NR_A3D; i++) {
    874                 if ((kcontrol =
    875                      snd_ctl_new1(&vortex_a3d_kcontrol, &vortex->a3d[i])) == NULL)
     876                kcontrol = snd_ctl_new1(&vortex_a3d_kcontrol, &vortex->a3d[i]);
     877                if (!kcontrol)
    876878                        return -ENOMEM;
    877879                kcontrol->id.numid = CTRLID_GAINS;
    878880                kcontrol->info = snd_vortex_a3d_ild_info;
    879881                kcontrol->put = snd_vortex_a3d_ild_put;
    880                 if ((err = snd_ctl_add(vortex->card, kcontrol)) < 0)
     882                err = snd_ctl_add(vortex->card, kcontrol);
     883                if (err < 0)
    881884                        return err;
    882885        }
    883886        /* Filter controls. */
    884887        for (i = 0; i < NR_A3D; i++) {
    885                 if ((kcontrol =
    886                      snd_ctl_new1(&vortex_a3d_kcontrol, &vortex->a3d[i])) == NULL)
     888                kcontrol = snd_ctl_new1(&vortex_a3d_kcontrol, &vortex->a3d[i]);
     889                if (!kcontrol)
    887890                        return -ENOMEM;
    888891                kcontrol->id.numid = CTRLID_FILTER;
    889892                kcontrol->info = snd_vortex_a3d_filter_info;
    890893                kcontrol->put = snd_vortex_a3d_filter_put;
    891                 if ((err = snd_ctl_add(vortex->card, kcontrol)) < 0)
     894                err = snd_ctl_add(vortex->card, kcontrol);
     895                if (err < 0)
    892896                        return err;
    893897        }
  • GPL/trunk/alsa-kernel/pci/au88x0/au88x0_core.c

    r679 r703  
    21212121        } else {
    21222122                en = 1;
    2123                 if ((dma =
    2124                      vortex_adb_checkinout(vortex, NULL, en,
    2125                                            VORTEX_RESOURCE_DMA)) < 0)
     2123                dma = vortex_adb_checkinout(vortex, NULL, en,
     2124                                            VORTEX_RESOURCE_DMA);
     2125                if (dma < 0)
    21262126                        return -EBUSY;
    21272127        }
     
    21412141                if (stream->type != VORTEX_PCM_SPDIF) {
    21422142                        for (i = 0; i < nr_ch; i++) {
    2143                                 if ((src[i] = vortex_adb_checkinout(vortex,
    2144                                                            stream->resources, en,
    2145                                                            VORTEX_RESOURCE_SRC)) < 0) {
     2143                                src[i] = vortex_adb_checkinout(vortex,
     2144                                                               stream->resources, en,
     2145                                                               VORTEX_RESOURCE_SRC);
     2146                                if (src[i] < 0) {
    21462147                                        memset(stream->resources, 0,
    21472148                                               sizeof(stream->resources));
     
    21492150                                }
    21502151                                if (stream->type != VORTEX_PCM_A3D) {
    2151                                         if ((mix[i] = vortex_adb_checkinout(vortex,
    2152                                                                    stream->resources,
    2153                                                                    en,
    2154                                                                    VORTEX_RESOURCE_MIXIN)) < 0) {
     2152                                        mix[i] = vortex_adb_checkinout(vortex,
     2153                                                                       stream->resources,
     2154                                                                       en,
     2155                                                                       VORTEX_RESOURCE_MIXIN);
     2156                                        if (mix[i] < 0) {
    21552157                                                memset(stream->resources,
    21562158                                                       0,
     
    21632165#ifndef CHIP_AU8820
    21642166                if (stream->type == VORTEX_PCM_A3D) {
    2165                         if ((a3d =
    2166                              vortex_adb_checkinout(vortex,
    2167                                                    stream->resources, en,
    2168                                                    VORTEX_RESOURCE_A3D)) < 0) {
     2167                        a3d = vortex_adb_checkinout(vortex,
     2168                                                    stream->resources, en,
     2169                                                    VORTEX_RESOURCE_A3D);
     2170                        if (a3d < 0) {
    21692171                                memset(stream->resources, 0,
    21702172                                       sizeof(stream->resources));
     
    22792281                /* Get SRC and MIXER hardware resources. */
    22802282                for (i = 0; i < nr_ch; i++) {
    2281                         if ((mix[i] =
    2282                              vortex_adb_checkinout(vortex,
    2283                                                    stream->resources, en,
    2284                                                    VORTEX_RESOURCE_MIXOUT))
    2285                             < 0) {
     2283                        mix[i] = vortex_adb_checkinout(vortex,
     2284                                                       stream->resources, en,
     2285                                                       VORTEX_RESOURCE_MIXOUT);
     2286                        if (mix[i] < 0) {
    22862287                                memset(stream->resources, 0,
    22872288                                       sizeof(stream->resources));
    22882289                                return -EBUSY;
    22892290                        }
    2290                         if ((src[i] =
    2291                              vortex_adb_checkinout(vortex,
    2292                                                    stream->resources, en,
    2293                                                    VORTEX_RESOURCE_SRC)) < 0) {
     2291                        src[i] = vortex_adb_checkinout(vortex,
     2292                                                       stream->resources, en,
     2293                                                       VORTEX_RESOURCE_SRC);
     2294                        if (src[i] < 0) {
    22942295                                memset(stream->resources, 0,
    22952296                                       sizeof(stream->resources));
  • GPL/trunk/alsa-kernel/pci/au88x0/au88x0_eq.c

    r679 r703  
    874874        vortex_Eqlzr_init(vortex);
    875875
    876         if ((kcontrol =
    877              snd_ctl_new1(&vortex_eqtoggle_kcontrol, vortex)) == NULL)
     876        kcontrol = snd_ctl_new1(&vortex_eqtoggle_kcontrol, vortex);
     877        if (!kcontrol)
    878878                return -ENOMEM;
    879879        kcontrol->private_value = 0;
    880         if ((err = snd_ctl_add(vortex->card, kcontrol)) < 0)
     880        err = snd_ctl_add(vortex->card, kcontrol);
     881        if (err < 0)
    881882                return err;
    882883
    883884        /* EQ gain controls */
    884885        for (i = 0; i < 10; i++) {
    885                 if ((kcontrol =
    886                      snd_ctl_new1(&vortex_eq_kcontrol, vortex)) == NULL)
     886                kcontrol = snd_ctl_new1(&vortex_eq_kcontrol, vortex);
     887                if (!kcontrol)
    887888                        return -ENOMEM;
    888889                snprintf(kcontrol->id.name, sizeof(kcontrol->id.name),
    889890                        "%s Playback Volume", EqBandLabels[i]);
    890891                kcontrol->private_value = i;
    891                 if ((err = snd_ctl_add(vortex->card, kcontrol)) < 0)
     892                err = snd_ctl_add(vortex->card, kcontrol);
     893                if (err < 0)
    892894                        return err;
    893895                //vortex->eqctrl[i] = kcontrol;
    894896        }
    895897        /* EQ band levels */
    896         if ((kcontrol = snd_ctl_new1(&vortex_levels_kcontrol, vortex)) == NULL)
     898        kcontrol = snd_ctl_new1(&vortex_levels_kcontrol, vortex);
     899        if (!kcontrol)
    897900                return -ENOMEM;
    898         if ((err = snd_ctl_add(vortex->card, kcontrol)) < 0)
     901        err = snd_ctl_add(vortex->card, kcontrol);
     902        if (err < 0)
    899903                return err;
    900904
  • GPL/trunk/alsa-kernel/pci/au88x0/au88x0_mixer.c

    r679 r703  
    3131        };
    3232
    33         if ((err = snd_ac97_bus(vortex->card, 0, &ops, NULL, &pbus)) < 0)
     33        err = snd_ac97_bus(vortex->card, 0, &ops, NULL, &pbus);
     34        if (err < 0)
    3435                return err;
    3536        memset(&ac97, 0, sizeof(ac97));
  • GPL/trunk/alsa-kernel/pci/au88x0/au88x0_mpu401.c

    r679 r703  
    6969        /* Create MPU401 instance. */
    7070#ifdef VORTEX_MPU401_LEGACY
    71         if ((temp =
    72              snd_mpu401_uart_new(vortex->card, 0, MPU401_HW_MPU401, 0x330,
    73                                  MPU401_INFO_IRQ_HOOK, -1, &rmidi)) != 0) {
     71        temp = snd_mpu401_uart_new(vortex->card, 0, MPU401_HW_MPU401, 0x330,
     72                                   MPU401_INFO_IRQ_HOOK, -1, &rmidi);
     73        if (temp) {
    7474                hwwrite(vortex->mmio, VORTEX_CTRL,
    7575                        (hwread(vortex->mmio, VORTEX_CTRL) &
     
    7979#else
    8080        port = (unsigned long)(vortex->mmio + VORTEX_MIDI_DATA);
    81         if ((temp =
    82              snd_mpu401_uart_new(vortex->card, 0, MPU401_HW_AUREAL, port,
    83                                  MPU401_INFO_INTEGRATED | MPU401_INFO_MMIO |
    84                                  MPU401_INFO_IRQ_HOOK, -1, &rmidi)) != 0) {
     81        temp = snd_mpu401_uart_new(vortex->card, 0, MPU401_HW_AUREAL, port,
     82                                   MPU401_INFO_INTEGRATED | MPU401_INFO_MMIO |
     83                                   MPU401_INFO_IRQ_HOOK, -1, &rmidi);
     84        if (temp) {
    8585                hwwrite(vortex->mmio, VORTEX_CTRL,
    8686                        (hwread(vortex->mmio, VORTEX_CTRL) &
  • GPL/trunk/alsa-kernel/pci/au88x0/au88x0_pcm.c

    r679 r703  
    131131       
    132132        /* Force equal size periods */
    133         if ((err =
    134              snd_pcm_hw_constraint_integer(runtime,
    135                                            SNDRV_PCM_HW_PARAM_PERIODS)) < 0)
     133        err = snd_pcm_hw_constraint_integer(runtime,
     134                                            SNDRV_PCM_HW_PARAM_PERIODS);
     135        if (err < 0)
    136136                return err;
    137137        /* Avoid PAGE_SIZE boundary to fall inside of a period. */
    138         if ((err =
    139              snd_pcm_hw_constraint_pow2(runtime, 0,
    140                                         SNDRV_PCM_HW_PARAM_PERIOD_BYTES)) < 0)
     138        err = snd_pcm_hw_constraint_pow2(runtime, 0,
     139                                         SNDRV_PCM_HW_PARAM_PERIOD_BYTES);
     140        if (err < 0)
    141141                return err;
    142142
     
    659659                        if (!kctl)
    660660                                return -ENOMEM;
    661                         if ((err = snd_ctl_add(chip->card, kctl)) < 0)
     661                        err = snd_ctl_add(chip->card, kctl);
     662                        if (err < 0)
    662663                                return err;
    663664                }
  • GPL/trunk/alsa-kernel/pci/azt3328.c

    r695 r703  
    11951195        for (idx = 0; idx < ARRAY_SIZE(snd_azf3328_mixer_controls);
    11961196                        ++idx, ++sw) {
    1197                 if ((err = snd_ctl_add(chip->card, snd_ctl_new1(sw, chip))) < 0)
     1197                err = snd_ctl_add(chip->card, snd_ctl_new1(sw, chip));
     1198                if (err < 0)
    11981199                        return err;
    11991200        }
  • GPL/trunk/alsa-kernel/pci/bt87x.c

    r695 r703  
    729729        spin_lock_init(&chip->reg_lock);
    730730
    731         if ((err = pci_request_regions(pci, "Bt87x audio")) < 0) {
     731        err = pci_request_regions(pci, "Bt87x audio");
     732        if (err < 0) {
    732733                kfree(chip);
    733734                pci_disable_device(pci);
  • GPL/trunk/alsa-kernel/pci/ca0106/ca0106_main.c

    r695 r703  
    580580        //channel->interrupt = snd_ca0106_pcm_channel_interrupt;
    581581        channel->epcm = epcm;
    582         if ((err = snd_pcm_hw_constraint_integer(runtime, SNDRV_PCM_HW_PARAM_PERIODS)) < 0)
     582        err = snd_pcm_hw_constraint_integer(runtime, SNDRV_PCM_HW_PARAM_PERIODS);
     583        if (err < 0)
    583584                return err;
    584         if ((err = snd_pcm_hw_constraint_step(runtime, 0, SNDRV_PCM_HW_PARAM_PERIOD_BYTES, 64)) < 0)
     585        err = snd_pcm_hw_constraint_step(runtime, 0, SNDRV_PCM_HW_PARAM_PERIOD_BYTES, 64);
     586        if (err < 0)
    585587                return err;
    586588        snd_pcm_set_sync(substream);
     
    673675        //channel->interrupt = snd_ca0106_pcm_channel_interrupt;
    674676        channel->epcm = epcm;
    675         if ((err = snd_pcm_hw_constraint_integer(runtime, SNDRV_PCM_HW_PARAM_PERIODS)) < 0)
     677        err = snd_pcm_hw_constraint_integer(runtime, SNDRV_PCM_HW_PARAM_PERIODS);
     678        if (err < 0)
    676679                return err;
    677680        //snd_pcm_hw_constraint_list(runtime, 0, SNDRV_PCM_HW_PARAM_PERIOD_SIZE, &hw_constraints_capture_period_sizes);
    678         if ((err = snd_pcm_hw_constraint_step(runtime, 0, SNDRV_PCM_HW_PARAM_PERIOD_BYTES, 64)) < 0)
     681        err = snd_pcm_hw_constraint_step(runtime, 0, SNDRV_PCM_HW_PARAM_PERIOD_BYTES, 64);
     682        if (err < 0)
    679683                return err;
    680684        return 0;
     
    11711175        };
    11721176 
    1173         if ((err = snd_ac97_bus(chip->card, 0, &ops, NULL, &pbus)) < 0)
     1177        err = snd_ac97_bus(chip->card, 0, &ops, NULL, &pbus);
     1178        if (err < 0)
    11741179                return err;
    11751180        pbus->no_vra = 1; /* we don't need VRA */
     
    17641769        midi->dev_id = chip;
    17651770       
    1766         if ((err = ca_midi_init(chip, midi, 0, name)) < 0)
     1771        err = ca_midi_init(chip, midi, 0, name);
     1772        if (err < 0)
    17671773                return err;
    17681774
  • GPL/trunk/alsa-kernel/pci/ca0106/ca_midi.c

    r679 r703  
    277277        int err;
    278278
    279         if ((err = snd_rawmidi_new(midi->get_dev_id_card(midi->dev_id), name, device, 1, 1, &rmidi)) < 0)
     279        err = snd_rawmidi_new(midi->get_dev_id_card(midi->dev_id), name, device, 1, 1, &rmidi);
     280        if (err < 0)
    280281                return err;
    281282
  • GPL/trunk/alsa-kernel/pci/cmipci.c

    r695 r703  
    12351235        rate = subs->runtime->rate;
    12361236
    1237         if (up && do_ac3)
    1238                 if ((err = save_mixer_state(cm)) < 0)
     1237        if (up && do_ac3) {
     1238                err = save_mixer_state(cm);
     1239                if (err < 0)
    12391240                        return err;
     1241        }
    12401242
    12411243        spin_lock_irq(&cm->reg_lock);
     
    12861288        if (do_spdif && cm->can_ac3_hw)
    12871289                do_ac3 = cm->dig_pcm_status & IEC958_AES0_NONAUDIO;
    1288         if ((err = setup_spdif_playback(cm, substream, do_spdif, do_ac3)) < 0)
     1290        err = setup_spdif_playback(cm, substream, do_spdif, do_ac3);
     1291        if (err < 0)
    12891292                return err;
    12901293        return snd_cmipci_pcm_prepare(cm, &cm->channel[CM_CH_PLAY], substream);
     
    13011304        else
    13021305                do_ac3 = 1; /* doesn't matter */
    1303         if ((err = setup_spdif_playback(cm, substream, 1, do_ac3)) < 0)
     1306        err = setup_spdif_playback(cm, substream, 1, do_ac3);
     1307        if (err < 0)
    13041308                return err;
    13051309        return snd_cmipci_pcm_prepare(cm, &cm->channel[CM_CH_PLAY], substream);
     
    16491653        int err;
    16501654
    1651         if ((err = open_device_check(cm, CM_OPEN_PLAYBACK, substream)) < 0)
     1655        err = open_device_check(cm, CM_OPEN_PLAYBACK, substream);
     1656        if (err < 0)
    16521657                return err;
    16531658        runtime->hw = snd_cmipci_playback;
     
    16751680        int err;
    16761681
    1677         if ((err = open_device_check(cm, CM_OPEN_CAPTURE, substream)) < 0)
     1682        err = open_device_check(cm, CM_OPEN_CAPTURE, substream);
     1683        if (err < 0)
    16781684                return err;
    16791685        runtime->hw = snd_cmipci_capture;
     
    16991705        int err;
    17001706
    1701         if ((err = open_device_check(cm, CM_OPEN_PLAYBACK2, substream)) < 0) /* use channel B */
     1707        /* use channel B */
     1708        err = open_device_check(cm, CM_OPEN_PLAYBACK2, substream);
     1709        if (err < 0)
    17021710                return err;
    17031711        runtime->hw = snd_cmipci_playback2;
     
    17371745        int err;
    17381746
    1739         if ((err = open_device_check(cm, CM_OPEN_SPDIF_PLAYBACK, substream)) < 0) /* use channel A */
     1747        /* use channel A */
     1748        err = open_device_check(cm, CM_OPEN_SPDIF_PLAYBACK, substream);
     1749        if (err < 0)
    17401750                return err;
    17411751        if (cm->can_ac3_hw) {
     
    17641774        int err;
    17651775
    1766         if ((err = open_device_check(cm, CM_OPEN_SPDIF_CAPTURE, substream)) < 0) /* use channel B */
     1776        /* use channel B */
     1777        err = open_device_check(cm, CM_OPEN_SPDIF_CAPTURE, substream);
     1778        if (err < 0)
    17671779                return err;
    17681780        runtime->hw = snd_cmipci_capture_spdif;
     
    26712683                                continue;
    26722684                }
    2673                 if ((err = snd_ctl_add(card, snd_ctl_new1(&snd_cmipci_mixers[idx], cm))) < 0)
     2685                err = snd_ctl_add(card, snd_ctl_new1(&snd_cmipci_mixers[idx], cm));
     2686                if (err < 0)
    26742687                        return err;
    26752688        }
     
    26962709                }
    26972710                if (cm->can_ac3_hw) {
    2698                         if ((err = snd_ctl_add(card, kctl = snd_ctl_new1(&snd_cmipci_spdif_default, cm))) < 0)
     2711                        kctl = snd_ctl_new1(&snd_cmipci_spdif_default, cm);
     2712                        err = snd_ctl_add(card, kctl);
     2713                        if (err < 0)
    26992714                                return err;
    27002715                        kctl->id.device = pcm_spdif_device;
    2701                         if ((err = snd_ctl_add(card, kctl = snd_ctl_new1(&snd_cmipci_spdif_mask, cm))) < 0)
     2716                        kctl = snd_ctl_new1(&snd_cmipci_spdif_mask, cm);
     2717                        err = snd_ctl_add(card, kctl);
     2718                        if (err < 0)
    27022719                                return err;
    27032720                        kctl->id.device = pcm_spdif_device;
    2704                         if ((err = snd_ctl_add(card, kctl = snd_ctl_new1(&snd_cmipci_spdif_stream, cm))) < 0)
     2721                        kctl = snd_ctl_new1(&snd_cmipci_spdif_stream, cm);
     2722                        err = snd_ctl_add(card, kctl);
     2723                        if (err < 0)
    27052724                                return err;
    27062725                        kctl->id.device = pcm_spdif_device;
     
    29762995                }
    29772996        }
    2978         if ((err = snd_opl3_hwdep_new(opl3, 0, 1, NULL)) < 0) {
     2997        err = snd_opl3_hwdep_new(opl3, 0, 1, NULL);
     2998        if (err < 0) {
    29792999                dev_err(cm->card->dev, "cannot create OPL3 hwdep\n");
    29803000                return err;
     
    30083028        *rcmipci = NULL;
    30093029
    3010         if ((err = pci_enable_device(pci)) < 0)
     3030        err = pci_enable_device(pci);
     3031        if (err < 0)
    30113032                return err;
    30123033
     
    30273048        cm->channel[0].is_dac = cm->channel[1].is_dac = 1; /* dual DAC mode */
    30283049
    3029         if ((err = pci_request_regions(pci, card->driver)) < 0) {
     3050        err = pci_request_regions(pci, card->driver);
     3051        if (err < 0) {
    30303052                kfree(cm);
    30313053                pci_disable_device(pci);
     
    31413163                card->shortname, modelstr, cm->iobase, cm->irq);
    31423164
    3143         if ((err = snd_device_new(card, SNDRV_DEV_LOWLEVEL, cm, &ops)) < 0) {
     3165        err = snd_device_new(card, SNDRV_DEV_LOWLEVEL, cm, &ops);
     3166        if (err < 0) {
    31443167                snd_cmipci_free(cm);
    31453168                return err;
     
    31933216        /* create pcm devices */
    31943217        pcm_index = pcm_spdif_index = 0;
    3195         if ((err = snd_cmipci_pcm_new(cm, pcm_index)) < 0)
     3218        err = snd_cmipci_pcm_new(cm, pcm_index);
     3219        if (err < 0)
    31963220                return err;
    31973221        pcm_index++;
    3198         if ((err = snd_cmipci_pcm2_new(cm, pcm_index)) < 0)
     3222        err = snd_cmipci_pcm2_new(cm, pcm_index);
     3223        if (err < 0)
    31993224                return err;
    32003225        pcm_index++;
    32013226        if (cm->can_ac3_hw || cm->can_ac3_sw) {
    32023227                pcm_spdif_index = pcm_index;
    3203                 if ((err = snd_cmipci_pcm_spdif_new(cm, pcm_index)) < 0)
     3228                err = snd_cmipci_pcm_spdif_new(cm, pcm_index);
     3229                if (err < 0)
    32043230                        return err;
    32053231        }
    32063232
    32073233        /* create mixer interface & switches */
    3208         if ((err = snd_cmipci_mixer_new(cm, pcm_spdif_index)) < 0)
     3234        err = snd_cmipci_mixer_new(cm, pcm_spdif_index);
     3235        if (err < 0)
    32093236                return err;
    32103237
    32113238        if (iomidi > 0) {
    3212                 if ((err = snd_mpu401_uart_new(card, 0, MPU401_HW_CMIPCI,
    3213                                                iomidi,
    3214                                                (integrated_midi ?
    3215                                                 MPU401_INFO_INTEGRATED : 0) |
    3216                                                MPU401_INFO_IRQ_HOOK,
    3217                                                -1, &cm->rmidi)) < 0) {
     3239                err = snd_mpu401_uart_new(card, 0, MPU401_HW_CMIPCI,
     3240                                          iomidi,
     3241                                          (integrated_midi ?
     3242                                           MPU401_INFO_INTEGRATED : 0) |
     3243                                          MPU401_INFO_IRQ_HOOK,
     3244                                          -1, &cm->rmidi);
     3245                if (err < 0)
    32183246                        dev_err(cm->card->dev,
    32193247                                "no UART401 device at 0x%lx\n", iomidi);
    3220                 }
    32213248        }
    32223249
  • GPL/trunk/alsa-kernel/pci/cs4281.c

    r695 r703  
    10721072        };
    10731073
    1074         if ((err = snd_ac97_bus(card, 0, &ops, chip, &chip->ac97_bus)) < 0)
     1074        err = snd_ac97_bus(card, 0, &ops, chip, &chip->ac97_bus);
     1075        if (err < 0)
    10751076                return err;
    10761077        chip->ac97_bus->private_free = snd_cs4281_mixer_free_ac97_bus;
     
    10791080        ac97.private_data = chip;
    10801081        ac97.private_free = snd_cs4281_mixer_free_ac97;
    1081         if ((err = snd_ac97_mixer(chip->ac97_bus, &ac97, &chip->ac97)) < 0)
     1082        err = snd_ac97_mixer(chip->ac97_bus, &ac97, &chip->ac97);
     1083        if (err < 0)
    10821084                return err;
    10831085        if (chip->dual_codec) {
    10841086                ac97.num = 1;
    1085                 if ((err = snd_ac97_mixer(chip->ac97_bus, &ac97, &chip->ac97_secondary)) < 0)
     1087                err = snd_ac97_mixer(chip->ac97_bus, &ac97, &chip->ac97_secondary);
     1088                if (err < 0)
    10861089                        return err;
    10871090        }
    1088         if ((err = snd_ctl_add(card, snd_ctl_new1(&snd_cs4281_fm_vol, chip))) < 0)
     1091        err = snd_ctl_add(card, snd_ctl_new1(&snd_cs4281_fm_vol, chip));
     1092        if (err < 0)
    10891093                return err;
    1090         if ((err = snd_ctl_add(card, snd_ctl_new1(&snd_cs4281_pcm_vol, chip))) < 0)
     1094        err = snd_ctl_add(card, snd_ctl_new1(&snd_cs4281_pcm_vol, chip));
     1095        if (err < 0)
    10911096                return err;
    10921097        return 0;
     
    13121317
    13131318        *rchip = NULL;
    1314         if ((err = pci_enable_device(pci)) < 0)
     1319        err = pci_enable_device(pci);
     1320        if (err < 0)
    13151321                return err;
    13161322        chip = kzalloc(sizeof(*chip), GFP_KERNEL);
     
    13301336        chip->dual_codec = dual_codec;
    13311337
    1332         if ((err = pci_request_regions(pci, "CS4281")) < 0) {
     1338        err = pci_request_regions(pci, "CS4281");
     1339        if (err < 0) {
    13331340                kfree(chip);
    13341341                pci_disable_device(pci);
     
    13601367        }
    13611368
    1362         if ((err = snd_device_new(card, SNDRV_DEV_LOWLEVEL, chip, &ops)) < 0) {
     1369        err = snd_device_new(card, SNDRV_DEV_LOWLEVEL, chip, &ops);
     1370        if (err < 0) {
    13631371                snd_cs4281_free(chip);
    13641372                return err;
     
    13991407        snd_cs4281_pokeBA0(chip, BA0_CWPR, 0x4281);
    14001408       
    1401         if ((tmp = snd_cs4281_peekBA0(chip, BA0_SERC1)) != (BA0_SERC1_SO1EN | BA0_SERC1_AC97)) {
     1409        tmp = snd_cs4281_peekBA0(chip, BA0_SERC1);
     1410        if (tmp != (BA0_SERC1_SO1EN | BA0_SERC1_AC97)) {
    14021411                dev_err(chip->card->dev,
    14031412                        "SERC1 AC'97 check failed (0x%x)\n", tmp);
    14041413                return -EIO;
    14051414        }
    1406         if ((tmp = snd_cs4281_peekBA0(chip, BA0_SERC2)) != (BA0_SERC2_SI1EN | BA0_SERC2_AC97)) {
     1415        tmp = snd_cs4281_peekBA0(chip, BA0_SERC2);
     1416        if (tmp != (BA0_SERC2_SI1EN | BA0_SERC2_AC97)) {
    14071417                dev_err(chip->card->dev,
    14081418                        "SERC2 AC'97 check failed (0x%x)\n", tmp);
     
    17521762        int err;
    17531763
    1754         if ((err = snd_rawmidi_new(chip->card, "CS4281", device, 1, 1, &rmidi)) < 0)
     1764        err = snd_rawmidi_new(chip->card, "CS4281", device, 1, 1, &rmidi);
     1765        if (err < 0)
    17551766                return err;
    17561767        strcpy(rmidi->name, "CS4281");
     
    18851896                return err;
    18861897
    1887         if ((err = snd_cs4281_create(card, pci, &chip, dual_codec[dev])) < 0) {
     1898        err = snd_cs4281_create(card, pci, &chip, dual_codec[dev]);
     1899        if (err < 0) {
    18881900                snd_card_free(card);
    18891901                return err;
     
    18911903        card->private_data = chip;
    18921904
    1893         if ((err = snd_cs4281_mixer(chip)) < 0) {
     1905        err = snd_cs4281_mixer(chip);
     1906        if (err < 0) {
    18941907                snd_card_free(card);
    18951908                return err;
    18961909        }
    1897         if ((err = snd_cs4281_pcm(chip, 0)) < 0) {
     1910        err = snd_cs4281_pcm(chip, 0);
     1911        if (err < 0) {
    18981912                snd_card_free(card);
    18991913                return err;
    19001914        }
    1901         if ((err = snd_cs4281_midi(chip, 0)) < 0) {
     1915        err = snd_cs4281_midi(chip, 0);
     1916        if (err < 0) {
    19021917                snd_card_free(card);
    19031918                return err;
    19041919        }
    1905         if ((err = snd_opl3_new(card, OPL3_HW_OPL3_CS4281, &opl3)) < 0) {
     1920        err = snd_opl3_new(card, OPL3_HW_OPL3_CS4281, &opl3);
     1921        if (err < 0) {
    19061922                snd_card_free(card);
    19071923                return err;
     
    19101926        opl3->command = snd_cs4281_opl3_command;
    19111927        snd_opl3_init(opl3);
    1912         if ((err = snd_opl3_hwdep_new(opl3, 0, 1, NULL)) < 0) {
     1928        err = snd_opl3_hwdep_new(opl3, 0, 1, NULL);
     1929        if (err < 0) {
    19131930                snd_card_free(card);
    19141931                return err;
     
    19221939                chip->irq);
    19231940
    1924         if ((err = snd_card_register(card)) < 0) {
     1941        err = snd_card_register(card);
     1942        if (err < 0) {
    19251943                snd_card_free(card);
    19261944                return err;
  • GPL/trunk/alsa-kernel/pci/cs46xx/cs46xx.c

    r695 r703  
    7878        if (err < 0)
    7979                return err;
    80         if ((err = snd_cs46xx_create(card, pci,
    81                                      external_amp[dev], thinkpad[dev],
    82                                      &chip)) < 0) {
     80        err = snd_cs46xx_create(card, pci,
     81                                external_amp[dev], thinkpad[dev],
     82                                &chip);
     83        if (err < 0) {
    8384                snd_card_free(card);
    8485                return err;
     
    8687        card->private_data = chip;
    8788        chip->accept_valid = mmap_valid[dev];
    88         if ((err = snd_cs46xx_pcm(chip, 0)) < 0) {
     89        err = snd_cs46xx_pcm(chip, 0);
     90        if (err < 0) {
    8991                snd_card_free(card);
    9092                return err;
    9193        }
    9294#ifdef CONFIG_SND_CS46XX_NEW_DSP
    93         if ((err = snd_cs46xx_pcm_rear(chip, 1)) < 0) {
     95        err = snd_cs46xx_pcm_rear(chip, 1);
     96        if (err < 0) {
    9497                snd_card_free(card);
    9598                return err;
    9699        }
    97         if ((err = snd_cs46xx_pcm_iec958(chip, 2)) < 0) {
     100        err = snd_cs46xx_pcm_iec958(chip, 2);
     101        if (err < 0) {
    98102                snd_card_free(card);
    99103                return err;
    100104        }
    101105#endif
    102         if ((err = snd_cs46xx_mixer(chip, 2)) < 0) {
     106        err = snd_cs46xx_mixer(chip, 2);
     107        if (err < 0) {
    103108                snd_card_free(card);
    104109                return err;
     
    106111#ifdef CONFIG_SND_CS46XX_NEW_DSP
    107112        if (chip->nr_ac97_codecs ==2) {
    108                 if ((err = snd_cs46xx_pcm_center_lfe(chip, 3)) < 0) {
     113                err = snd_cs46xx_pcm_center_lfe(chip, 3);
     114                if (err < 0) {
    109115                        snd_card_free(card);
    110116                        return err;
     
    112118        }
    113119#endif
    114         if ((err = snd_cs46xx_midi(chip, 0)) < 0) {
     120        err = snd_cs46xx_midi(chip, 0);
     121        if (err < 0) {
    115122                snd_card_free(card);
    116123                return err;
    117124        }
    118         if ((err = snd_cs46xx_start_dsp(chip)) < 0) {
     125        err = snd_cs46xx_start_dsp(chip);
     126        if (err < 0) {
    119127                snd_card_free(card);
    120128                return err;
     
    132140                chip->irq);
    133141
    134         if ((err = snd_card_register(card)) < 0) {
     142        err = snd_card_register(card);
     143        if (err < 0) {
    135144                snd_card_free(card);
    136145                return err;
  • GPL/trunk/alsa-kernel/pci/cs46xx/cs46xx_lib.c

    r695 r703  
    10631063                cs46xx_dsp_destroy_pcm_channel (chip,cpcm->pcm_channel);
    10641064
    1065                 if ( (cpcm->pcm_channel = cs46xx_dsp_create_pcm_channel (chip, sample_rate, cpcm,
    1066                                                                          cpcm->hw_buf.addr,
    1067                                                                          cpcm->pcm_channel_id)) == NULL) {
     1065                cpcm->pcm_channel = cs46xx_dsp_create_pcm_channel(chip, sample_rate, cpcm,
     1066                                                                  cpcm->hw_buf.addr,
     1067                                                                  cpcm->pcm_channel_id);
     1068                if (!cpcm->pcm_channel) {
    10681069                        dev_err(chip->card->dev,
    10691070                                "failed to re-create virtual PCM channel\n");
     
    11521153                        runtime->dma_bytes = 0;
    11531154                }
    1154                 if ((err = snd_pcm_lib_malloc_pages(substream, params_buffer_bytes(hw_params))) < 0) {
     1155                err = snd_pcm_lib_malloc_pages(substream, params_buffer_bytes(hw_params));
     1156                if (err < 0) {
    11551157#ifdef CONFIG_SND_CS46XX_NEW_DSP
    11561158                        mutex_unlock(&chip->spos_mutex);
     
    13001302                        runtime->dma_bytes = 0;
    13011303                }
    1302                 if ((err = snd_pcm_lib_malloc_pages(substream, params_buffer_bytes(hw_params))) < 0)
     1304                err = snd_pcm_lib_malloc_pages(substream, params_buffer_bytes(hw_params));
     1305                if (err < 0)
    13031306                        return err;
    13041307                substream->ops = &snd_cs46xx_capture_indirect_ops;
     
    17651768        int err;
    17661769
    1767         if ((err = snd_pcm_new(chip->card, "CS46xx", device, MAX_PLAYBACK_CHANNELS, 1, &pcm)) < 0)
     1770        err = snd_pcm_new(chip->card, "CS46xx", device, MAX_PLAYBACK_CHANNELS, 1, &pcm);
     1771        if (err < 0)
    17681772                return err;
    17691773
     
    17921796        int err;
    17931797
    1794         if ((err = snd_pcm_new(chip->card, "CS46xx - Rear", device, MAX_PLAYBACK_CHANNELS, 0, &pcm)) < 0)
     1798        err = snd_pcm_new(chip->card, "CS46xx - Rear", device, MAX_PLAYBACK_CHANNELS, 0, &pcm);
     1799        if (err < 0)
    17951800                return err;
    17961801
     
    18161821        int err;
    18171822
    1818         if ((err = snd_pcm_new(chip->card, "CS46xx - Center LFE", device, MAX_PLAYBACK_CHANNELS, 0, &pcm)) < 0)
     1823        err = snd_pcm_new(chip->card, "CS46xx - Center LFE", device, MAX_PLAYBACK_CHANNELS, 0, &pcm);
     1824        if (err < 0)
    18191825                return err;
    18201826
     
    18401846        int err;
    18411847
    1842         if ((err = snd_pcm_new(chip->card, "CS46xx - IEC958", device, 1, 0, &pcm)) < 0)
     1848        err = snd_pcm_new(chip->card, "CS46xx - IEC958", device, 1, 0, &pcm);
     1849        if (err < 0)
    18431850                return err;
    18441851
     
    24192426                /* test if we can write to the record gain volume register */
    24202427                snd_ac97_write(ac97, AC97_REC_GAIN, 0x8a05);
    2421                 if ((err = snd_ac97_read(ac97, AC97_REC_GAIN)) == 0x8a05)
     2428                err = snd_ac97_read(ac97, AC97_REC_GAIN);
     2429                if (err == 0x8a05)
    24222430                        return;
    24232431
     
    24812489        chip->nr_ac97_codecs = 0;
    24822490        dev_dbg(chip->card->dev, "detecting primary codec\n");
    2483         if ((err = snd_ac97_bus(card, 0, &ops, chip, &chip->ac97_bus)) < 0)
     2491        err = snd_ac97_bus(card, 0, &ops, chip, &chip->ac97_bus);
     2492        if (err < 0)
    24842493                return err;
    24852494        chip->ac97_bus->private_free = snd_cs46xx_mixer_free_ac97_bus;
     
    25022511                if (kctl && kctl->id.iface == SNDRV_CTL_ELEM_IFACE_PCM)
    25032512                        kctl->id.device = spdif_device;
    2504                 if ((err = snd_ctl_add(card, kctl)) < 0)
     2513                err = snd_ctl_add(card, kctl);
     2514                if (err < 0)
    25052515                        return err;
    25062516        }
     
    26892699        int err;
    26902700
    2691         if ((err = snd_rawmidi_new(chip->card, "CS46XX", device, 1, 1, &rmidi)) < 0)
     2701        err = snd_rawmidi_new(chip->card, "CS46XX", device, 1, 1, &rmidi);
     2702        if (err < 0)
    26922703                return err;
    26932704        strcpy(rmidi->name, "CS46XX");
     
    35313542
    35323543                kctl = snd_ctl_new1(&snd_hercules_controls[idx], chip);
    3533                 if ((err = snd_ctl_add(card, kctl)) < 0) {
     3544                err = snd_ctl_add(card, kctl);
     3545                if (err < 0) {
    35343546                        dev_err(card->dev,
    35353547                                "failed to initialize Hercules mixer (%d)\n",
     
    38763888
    38773889        /* enable PCI device */
    3878         if ((err = pci_enable_device(pci)) < 0)
     3890        err = pci_enable_device(pci);
     3891        if (err < 0)
    38793892                return err;
    38803893
     
    39703983        for (idx = 0; idx < 5; idx++) {
    39713984                region = &chip->region.idx[idx];
    3972                 if ((region->resource = request_mem_region(region->base, region->size,
    3973                                                            region->name)) == NULL) {
     3985                region->resource = request_mem_region(region->base, region->size,
     3986                                                      region->name);
     3987                if (!region->resource) {
    39743988                        dev_err(chip->card->dev,
    39753989                                "unable to request memory region 0x%lx-0x%lx\n",
     
    40104024        }
    40114025
    4012         if ((err = snd_device_new(card, SNDRV_DEV_LOWLEVEL, chip, &ops)) < 0) {
     4026        err = snd_device_new(card, SNDRV_DEV_LOWLEVEL, chip, &ops);
     4027        if (err < 0) {
    40134028                snd_cs46xx_free(chip);
    40144029                return err;
  • GPL/trunk/alsa-kernel/pci/cs46xx/dsp_spos.c

    r679 r703  
    618618                }
    619619
    620                 if ( (symbol = cs46xx_dsp_lookup_symbol_addr (chip,i / sizeof(u32), SYMBOL_PARAMETER)) != NULL) {
     620                symbol = cs46xx_dsp_lookup_symbol_addr(chip, i / sizeof(u32), SYMBOL_PARAMETER);
     621                if (symbol) {
    621622                        col = 0;
    622623                        snd_iprintf (buffer,"\n%s:\n",symbol->symbol_name);
  • GPL/trunk/alsa-kernel/pci/cs5535audio/cs5535audio.c

    r695 r703  
    148148        };
    149149
    150         if ((err = snd_ac97_bus(card, 0, &ops, NULL, &pbus)) < 0)
     150        err = snd_ac97_bus(card, 0, &ops, NULL, &pbus);
     151        if (err < 0)
    151152                return err;
    152153
     
    160161        olpc_prequirks(card, &ac97);
    161162
    162         if ((err = snd_ac97_mixer(pbus, &ac97, &cs5535au->ac97)) < 0) {
     163        err = snd_ac97_mixer(pbus, &ac97, &cs5535au->ac97);
     164        if (err < 0) {
    163165                dev_err(card->dev, "mixer failed\n");
    164166                return err;
     
    271273
    272274        *rcs5535au = NULL;
    273         if ((err = pci_enable_device(pci)) < 0)
     275        err = pci_enable_device(pci);
     276        if (err < 0)
    274277                return err;
    275278
     
    291294        cs5535au->irq = -1;
    292295
    293         if ((err = pci_request_regions(pci, "CS5535 Audio")) < 0) {
     296        err = pci_request_regions(pci, "CS5535 Audio");
     297        if (err < 0) {
    294298                kfree(cs5535au);
    295299                goto pcifail;
     
    309313        pci_set_master(pci);
    310314
    311         if ((err = snd_device_new(card, SNDRV_DEV_LOWLEVEL,
    312                                   cs5535au, &ops)) < 0)
     315        err = snd_device_new(card, SNDRV_DEV_LOWLEVEL, cs5535au, &ops);
     316        if (err < 0)
    313317                goto sndfail;
    314318
     
    345349                return err;
    346350
    347         if ((err = snd_cs5535audio_create(card, pci, &cs5535au)) < 0)
     351        err = snd_cs5535audio_create(card, pci, &cs5535au);
     352        if (err < 0)
    348353                goto probefail_out;
    349354
    350355        card->private_data = cs5535au;
    351356
    352         if ((err = snd_cs5535audio_mixer(cs5535au)) < 0)
     357        err = snd_cs5535audio_mixer(cs5535au);
     358        if (err < 0)
    353359                goto probefail_out;
    354360
    355         if ((err = snd_cs5535audio_pcm(cs5535au)) < 0)
     361        err = snd_cs5535audio_pcm(cs5535au);
     362        if (err < 0)
    356363                goto probefail_out;
    357364
     
    363370                cs5535au->port, cs5535au->irq);
    364371
    365         if ((err = snd_card_register(card)) < 0)
     372        err = snd_card_register(card);
     373        if (err < 0)
    366374                goto probefail_out;
    367375
  • GPL/trunk/alsa-kernel/pci/cs5535audio/cs5535audio_pcm.c

    r679 r703  
    8888        cs5535au->playback_substream = substream;
    8989        runtime->private_data = &(cs5535au->dmas[CS5535AUDIO_DMA_PLAYBACK]);
    90         if ((err = snd_pcm_hw_constraint_integer(runtime,
    91                                 SNDRV_PCM_HW_PARAM_PERIODS)) < 0)
     90        err = snd_pcm_hw_constraint_integer(runtime,
     91                                            SNDRV_PCM_HW_PARAM_PERIODS);
     92        if (err < 0)
    9293                return err;
    9394
     
    343344        cs5535au->capture_substream = substream;
    344345        runtime->private_data = &(cs5535au->dmas[CS5535AUDIO_DMA_CAPTURE]);
    345         if ((err = snd_pcm_hw_constraint_integer(runtime,
    346                                          SNDRV_PCM_HW_PARAM_PERIODS)) < 0)
     346        err = snd_pcm_hw_constraint_integer(runtime,
     347                                            SNDRV_PCM_HW_PARAM_PERIODS);
     348        if (err < 0)
    347349                return err;
    348350        olpc_capture_open(cs5535au->ac97);
  • GPL/trunk/alsa-kernel/pci/emu10k1/emu10k1.c

    r695 r703  
    122122        else if (max_buffer_size[dev] > 1024)
    123123                max_buffer_size[dev] = 1024;
    124         if ((err = snd_emu10k1_create(card, pci, extin[dev], extout[dev],
    125                                       (long)max_buffer_size[dev] * 1024 * 1024,
    126                                       enable_ir[dev], subsystem[dev],
    127                                       &emu)) < 0)
     124        err = snd_emu10k1_create(card, pci, extin[dev], extout[dev],
     125                                 (long)max_buffer_size[dev] * 1024 * 1024,
     126                                 enable_ir[dev], subsystem[dev],
     127                                 &emu);
     128        if (err < 0)
    128129                goto error;
    129130        card->private_data = emu;
    130131        emu->delay_pcm_irq = delay_pcm_irq[dev] & 0x1f;
    131         if ((err = snd_emu10k1_pcm(emu, 0)) < 0)
    132                 goto error;
    133         if ((err = snd_emu10k1_pcm_mic(emu, 1)) < 0)
    134                 goto error;
    135         if ((err = snd_emu10k1_pcm_efx(emu, 2)) < 0)
     132        err = snd_emu10k1_pcm(emu, 0);
     133        if (err < 0)
     134                goto error;
     135        err = snd_emu10k1_pcm_mic(emu, 1);
     136        if (err < 0)
     137                goto error;
     138        err = snd_emu10k1_pcm_efx(emu, 2);
     139        if (err < 0)
    136140                goto error;
    137141        /* This stores the periods table. */
     
    143147        }
    144148
    145         if ((err = snd_emu10k1_mixer(emu, 0, 3)) < 0)
     149        err = snd_emu10k1_mixer(emu, 0, 3);
     150        if (err < 0)
    146151                goto error;
    147152       
    148         if ((err = snd_emu10k1_timer(emu, 0)) < 0)
    149                 goto error;
    150 
    151         if ((err = snd_emu10k1_pcm_multi(emu, 3)) < 0)
     153        err = snd_emu10k1_timer(emu, 0);
     154        if (err < 0)
     155                goto error;
     156
     157        err = snd_emu10k1_pcm_multi(emu, 3);
     158        if (err < 0)
    152159                goto error;
    153160        if (emu->card_capabilities->ca0151_chip) { /* P16V */
    154                 if ((err = snd_p16v_pcm(emu, 4)) < 0)
     161                err = snd_p16v_pcm(emu, 4);
     162                if (err < 0)
    155163                        goto error;
    156164        }
    157165        if (emu->audigy) {
    158                 if ((err = snd_emu10k1_audigy_midi(emu)) < 0)
     166                err = snd_emu10k1_audigy_midi(emu);
     167                if (err < 0)
    159168                        goto error;
    160169        } else {
    161                 if ((err = snd_emu10k1_midi(emu)) < 0)
    162                         goto error;
    163         }
    164         if ((err = snd_emu10k1_fx8010_new(emu, 0)) < 0)
     170                err = snd_emu10k1_midi(emu);
     171                if (err < 0)
     172                        goto error;
     173        }
     174        err = snd_emu10k1_fx8010_new(emu, 0);
     175        if (err < 0)
    165176                goto error;
    166177#ifdef ENABLE_SYNTH
     
    189200                 card->shortname, emu->revision, emu->serial, emu->port, emu->irq);
    190201
    191         if ((err = snd_card_register(card)) < 0)
     202        err = snd_card_register(card);
     203        if (err < 0)
    192204                goto error;
    193205
  • GPL/trunk/alsa-kernel/pci/emu10k1/emu10k1_callback.c

    r679 r703  
    9191                        int ch;
    9292                        vp = &emu->voices[best[i].voice];
    93                         if ((ch = vp->ch) < 0) {
     93                        ch = vp->ch;
     94                        if (ch < 0) {
    9495                                /*
    9596                                dev_warn(emu->card->dev,
  • GPL/trunk/alsa-kernel/pci/emu10k1/emu10k1x.c

    r695 r703  
    353353        struct emu10k1x_pcm *epcm;
    354354
    355         if ((epcm = voice->epcm) == NULL)
     355        epcm = voice->epcm;
     356        if (!epcm)
    356357                return;
    357358        if (epcm->substream == NULL)
     
    375376        int err;
    376377
    377         if ((err = snd_pcm_hw_constraint_integer(runtime, SNDRV_PCM_HW_PARAM_PERIODS)) < 0) {
    378                 return err;
    379         }
    380         if ((err = snd_pcm_hw_constraint_step(runtime, 0, SNDRV_PCM_HW_PARAM_PERIOD_BYTES, 64)) < 0)
     378        err = snd_pcm_hw_constraint_integer(runtime, SNDRV_PCM_HW_PARAM_PERIODS);
     379        if (err < 0)
     380                return err;
     381        err = snd_pcm_hw_constraint_step(runtime, 0, SNDRV_PCM_HW_PARAM_PERIOD_BYTES, 64);
     382        if (err < 0)
    381383                return err;
    382384
     
    554556        int err;
    555557
    556         if ((err = snd_pcm_hw_constraint_integer(runtime, SNDRV_PCM_HW_PARAM_PERIODS)) < 0)
    557                 return err;
    558         if ((err = snd_pcm_hw_constraint_step(runtime, 0, SNDRV_PCM_HW_PARAM_PERIOD_BYTES, 64)) < 0)
    559                 return err;
     558        err = snd_pcm_hw_constraint_integer(runtime, SNDRV_PCM_HW_PARAM_PERIODS);
     559        if (err < 0)
     560                return err;
     561        err = snd_pcm_hw_constraint_step(runtime, 0, SNDRV_PCM_HW_PARAM_PERIOD_BYTES, 64);
     562        if (err < 0)
     563                return err;
    560564
    561565        epcm = kzalloc(sizeof(*epcm), GFP_KERNEL);
     
    726730        };
    727731 
    728         if ((err = snd_ac97_bus(chip->card, 0, &ops, NULL, &pbus)) < 0)
     732        err = snd_ac97_bus(chip->card, 0, &ops, NULL, &pbus);
     733        if (err < 0)
    729734                return err;
    730735        pbus->no_vra = 1; /* we don't need VRA */
     
    842847                capture = 1;
    843848       
    844         if ((err = snd_pcm_new(emu->card, "emu10k1x", device, 1, capture, &pcm)) < 0)
     849        err = snd_pcm_new(emu->card, "emu10k1x", device, 1, capture, &pcm);
     850        if (err < 0)
    845851                return err;
    846852 
     
    895901        *rchip = NULL;
    896902
    897         if ((err = pci_enable_device(pci)) < 0)
     903        err = pci_enable_device(pci);
     904        if (err < 0)
    898905                return err;
    899906
     
    918925 
    919926        chip->port = pci_resource_start(pci, 0);
    920         if ((chip->res_port = request_region(chip->port, 8,
    921                                              "EMU10K1X")) == NULL) {
     927        chip->res_port = request_region(chip->port, 8, "EMU10K1X");
     928        if (!chip->res_port) {
    922929                dev_err(card->dev, "cannot allocate the port 0x%lx\n",
    923930                        chip->port);
     
    9991006        outl(HCFG_LOCKSOUNDCACHE|HCFG_AUDIOENABLE, chip->port+HCFG);
    10001007
    1001         if ((err = snd_device_new(card, SNDRV_DEV_LOWLEVEL,
    1002                                   chip, &ops)) < 0) {
     1008        err = snd_device_new(card, SNDRV_DEV_LOWLEVEL, chip, &ops);
     1009        if (err < 0) {
    10031010                snd_emu10k1x_free(chip);
    10041011                return err;
     
    11791186        struct snd_card *card = emu->card;
    11801187
    1181         if ((kctl = snd_ctl_new1(&snd_emu10k1x_spdif_mask_control, emu)) == NULL)
     1188        kctl = snd_ctl_new1(&snd_emu10k1x_spdif_mask_control, emu);
     1189        if (!kctl)
    11821190                return -ENOMEM;
    1183         if ((err = snd_ctl_add(card, kctl)))
    1184                 return err;
    1185         if ((kctl = snd_ctl_new1(&snd_emu10k1x_shared_spdif, emu)) == NULL)
     1191        err = snd_ctl_add(card, kctl);
     1192        if (err)
     1193                return err;
     1194        kctl = snd_ctl_new1(&snd_emu10k1x_shared_spdif, emu);
     1195        if (!kctl)
    11861196                return -ENOMEM;
    1187         if ((err = snd_ctl_add(card, kctl)))
    1188                 return err;
    1189         if ((kctl = snd_ctl_new1(&snd_emu10k1x_spdif_control, emu)) == NULL)
     1197        err = snd_ctl_add(card, kctl);
     1198        if (err)
     1199                return err;
     1200        kctl = snd_ctl_new1(&snd_emu10k1x_spdif_control, emu);
     1201        if (!kctl)
    11901202                return -ENOMEM;
    1191         if ((err = snd_ctl_add(card, kctl)))
     1203        err = snd_ctl_add(card, kctl);
     1204        if (err)
    11921205                return err;
    11931206
     
    14961509        int err;
    14971510
    1498         if ((err = snd_rawmidi_new(emu->card, name, device, 1, 1, &rmidi)) < 0)
     1511        err = snd_rawmidi_new(emu->card, name, device, 1, 1, &rmidi);
     1512        if (err < 0)
    14991513                return err;
    15001514        midi->emu = emu;
     
    15191533        int err;
    15201534
    1521         if ((err = emu10k1x_midi_init(emu, midi, 0, "EMU10K1X MPU-401 (UART)")) < 0)
     1535        err = emu10k1x_midi_init(emu, midi, 0, "EMU10K1X MPU-401 (UART)");
     1536        if (err < 0)
    15221537                return err;
    15231538
     
    15511566                return err;
    15521567
    1553         if ((err = snd_emu10k1x_create(card, pci, &chip)) < 0) {
     1568        err = snd_emu10k1x_create(card, pci, &chip);
     1569        if (err < 0) {
    15541570                snd_card_free(card);
    15551571                return err;
    15561572        }
    15571573
    1558         if ((err = snd_emu10k1x_pcm(chip, 0)) < 0) {
     1574        err = snd_emu10k1x_pcm(chip, 0);
     1575        if (err < 0) {
    15591576                snd_card_free(card);
    15601577                return err;
    15611578        }
    1562         if ((err = snd_emu10k1x_pcm(chip, 1)) < 0) {
     1579        err = snd_emu10k1x_pcm(chip, 1);
     1580        if (err < 0) {
    15631581                snd_card_free(card);
    15641582                return err;
    15651583        }
    1566         if ((err = snd_emu10k1x_pcm(chip, 2)) < 0) {
     1584        err = snd_emu10k1x_pcm(chip, 2);
     1585        if (err < 0) {
    15671586                snd_card_free(card);
    15681587                return err;
    15691588        }
    15701589
    1571         if ((err = snd_emu10k1x_ac97(chip)) < 0) {
     1590        err = snd_emu10k1x_ac97(chip);
     1591        if (err < 0) {
    15721592                snd_card_free(card);
    15731593                return err;
    15741594        }
    15751595
    1576         if ((err = snd_emu10k1x_mixer(chip)) < 0) {
     1596        err = snd_emu10k1x_mixer(chip);
     1597        if (err < 0) {
    15771598                snd_card_free(card);
    15781599                return err;
    15791600        }
    15801601       
    1581         if ((err = snd_emu10k1x_midi(chip)) < 0) {
     1602        err = snd_emu10k1x_midi(chip);
     1603        if (err < 0) {
    15821604                snd_card_free(card);
    15831605                return err;
     
    15911613                card->shortname, chip->port, chip->irq);
    15921614
    1593         if ((err = snd_card_register(card)) < 0) {
     1615        err = snd_card_register(card);
     1616        if (err < 0) {
    15941617                snd_card_free(card);
    15951618                return err;
  • GPL/trunk/alsa-kernel/pci/emu10k1/emufx.c

    r695 r703  
    438438       
    439439        spin_lock_irqsave(&emu->fx8010.irq_lock, flags);
    440         if ((tmp = emu->fx8010.irq_handlers) == irq) {
     440        tmp = emu->fx8010.irq_handlers;
     441        if (tmp == irq) {
    441442                emu->fx8010.irq_handlers = tmp->next;
    442443                if (emu->fx8010.irq_handlers == NULL) {
     
    873874                        knew.private_value = (unsigned long)ctl;
    874875                        *ctl = *nctl;
    875                         if ((err = snd_ctl_add(emu->card, kctl = snd_ctl_new1(&knew, emu))) < 0) {
     876                        kctl = snd_ctl_new1(&knew, emu);
     877                        err = snd_ctl_add(emu->card, kctl);
     878                        if (err < 0) {
    876879                                kfree(ctl);
    877880                                kfree(knew.tlv.p);
     
    24052408                OP(icode, &ptr, iACC3, C_00000000, C_00000000, C_00000000, C_00000000);
    24062409
    2407         if ((err = snd_emu10k1_fx8010_tram_setup(emu, ipcm->buffer_size)) < 0)
     2410        err = snd_emu10k1_fx8010_tram_setup(emu, ipcm->buffer_size);
     2411        if (err < 0)
    24082412                goto __err;
    24092413        icode->gpr_add_control_count = i;
     
    26832687        int err;
    26842688       
    2685         if ((err = snd_hwdep_new(emu->card, "FX8010", device, &hw)) < 0)
     2689        err = snd_hwdep_new(emu->card, "FX8010", device, &hw);
     2690        if (err < 0)
    26862691                return err;
    26872692        strcpy(hw->name, "EMU10K1 (FX8010)");
  • GPL/trunk/alsa-kernel/pci/emu10k1/emumixer.c

    r679 r703  
    11201120        tmp = reg & ~A_SPDIF_RATE_MASK;
    11211121        tmp |= val;
    1122         if ((change = (tmp != reg)))
     1122        change = (tmp != reg);
     1123        if (change)
    11231124                snd_emu10k1_ptr_write(emu, A_SPDIF_SAMPLERATE, 0, tmp);
    11241125        spin_unlock_irqrestore(&emu->reg_lock, flags);
     
    19041905                };
    19051906
    1906                 if ((err = snd_ac97_bus(emu->card, 0, &ops, NULL, &pbus)) < 0)
     1907                err = snd_ac97_bus(emu->card, 0, &ops, NULL, &pbus);
     1908                if (err < 0)
    19071909                        return err;
    19081910                pbus->no_vra = 1; /* we don't need VRA */
     
    19121914                ac97.private_free = snd_emu10k1_mixer_free_ac97;
    19131915                ac97.scaps = AC97_SCAP_NO_SPDIF;
    1914                 if ((err = snd_ac97_mixer(pbus, &ac97, &emu->ac97)) < 0) {
     1916                err = snd_ac97_mixer(pbus, &ac97, &emu->ac97);
     1917                if (err < 0) {
    19151918                        if (emu->card_capabilities->ac97_chip == 1)
    19161919                                return err;
     
    19921995                rename_ctl(card, "Mic Capture Volume", "Unknown1 Capture Volume");
    19931996        }
    1994         if ((kctl = emu->ctl_send_routing = snd_ctl_new1(&snd_emu10k1_send_routing_control, emu)) == NULL)
     1997        kctl = emu->ctl_send_routing = snd_ctl_new1(&snd_emu10k1_send_routing_control, emu);
     1998        if (!kctl)
    19951999                return -ENOMEM;
    19962000        kctl->id.device = pcm_device;
    1997         if ((err = snd_ctl_add(card, kctl)))
     2001        err = snd_ctl_add(card, kctl);
     2002        if (err)
    19982003                return err;
    1999         if ((kctl = emu->ctl_send_volume = snd_ctl_new1(&snd_emu10k1_send_volume_control, emu)) == NULL)
     2004        kctl = emu->ctl_send_volume = snd_ctl_new1(&snd_emu10k1_send_volume_control, emu);
     2005        if (!kctl)
    20002006                return -ENOMEM;
    20012007        kctl->id.device = pcm_device;
    2002         if ((err = snd_ctl_add(card, kctl)))
     2008        err = snd_ctl_add(card, kctl);
     2009        if (err)
    20032010                return err;
    2004         if ((kctl = emu->ctl_attn = snd_ctl_new1(&snd_emu10k1_attn_control, emu)) == NULL)
     2011        kctl = emu->ctl_attn = snd_ctl_new1(&snd_emu10k1_attn_control, emu);
     2012        if (!kctl)
    20052013                return -ENOMEM;
    20062014        kctl->id.device = pcm_device;
    2007         if ((err = snd_ctl_add(card, kctl)))
     2015        err = snd_ctl_add(card, kctl);
     2016        if (err)
    20082017                return err;
    20092018
    2010         if ((kctl = emu->ctl_efx_send_routing = snd_ctl_new1(&snd_emu10k1_efx_send_routing_control, emu)) == NULL)
     2019        kctl = emu->ctl_efx_send_routing = snd_ctl_new1(&snd_emu10k1_efx_send_routing_control, emu);
     2020        if (!kctl)
    20112021                return -ENOMEM;
    20122022        kctl->id.device = multi_device;
    2013         if ((err = snd_ctl_add(card, kctl)))
     2023        err = snd_ctl_add(card, kctl);
     2024        if (err)
    20142025                return err;
    20152026       
    2016         if ((kctl = emu->ctl_efx_send_volume = snd_ctl_new1(&snd_emu10k1_efx_send_volume_control, emu)) == NULL)
     2027        kctl = emu->ctl_efx_send_volume = snd_ctl_new1(&snd_emu10k1_efx_send_volume_control, emu);
     2028        if (!kctl)
    20172029                return -ENOMEM;
    20182030        kctl->id.device = multi_device;
    2019         if ((err = snd_ctl_add(card, kctl)))
     2031        err = snd_ctl_add(card, kctl);
     2032        if (err)
    20202033                return err;
    20212034       
    2022         if ((kctl = emu->ctl_efx_attn = snd_ctl_new1(&snd_emu10k1_efx_attn_control, emu)) == NULL)
     2035        kctl = emu->ctl_efx_attn = snd_ctl_new1(&snd_emu10k1_efx_attn_control, emu);
     2036        if (!kctl)
    20232037                return -ENOMEM;
    20242038        kctl->id.device = multi_device;
    2025         if ((err = snd_ctl_add(card, kctl)))
     2039        err = snd_ctl_add(card, kctl);
     2040        if (err)
    20262041                return err;
    20272042
     
    20702085        if (! emu->card_capabilities->ecard) { /* FIXME: APS has these controls? */
    20712086                /* sb live! and audigy */
    2072                 if ((kctl = snd_ctl_new1(&snd_emu10k1_spdif_mask_control, emu)) == NULL)
     2087                kctl = snd_ctl_new1(&snd_emu10k1_spdif_mask_control, emu);
     2088                if (!kctl)
    20732089                        return -ENOMEM;
    20742090                if (!emu->audigy)
    20752091                        kctl->id.device = emu->pcm_efx->device;
    2076                 if ((err = snd_ctl_add(card, kctl)))
     2092                err = snd_ctl_add(card, kctl);
     2093                if (err)
    20772094                        return err;
    2078                 if ((kctl = snd_ctl_new1(&snd_emu10k1_spdif_control, emu)) == NULL)
     2095                kctl = snd_ctl_new1(&snd_emu10k1_spdif_control, emu);
     2096                if (!kctl)
    20792097                        return -ENOMEM;
    20802098                if (!emu->audigy)
    20812099                        kctl->id.device = emu->pcm_efx->device;
    2082                 if ((err = snd_ctl_add(card, kctl)))
     2100                err = snd_ctl_add(card, kctl);
     2101                if (err)
    20832102                        return err;
    20842103        }
     
    20872106                ;  /* Disable the snd_audigy_spdif_shared_spdif */
    20882107        } else if (emu->audigy) {
    2089                 if ((kctl = snd_ctl_new1(&snd_audigy_shared_spdif, emu)) == NULL)
     2108                kctl = snd_ctl_new1(&snd_audigy_shared_spdif, emu);
     2109                if (!kctl)
    20902110                        return -ENOMEM;
    2091                 if ((err = snd_ctl_add(card, kctl)))
     2111                err = snd_ctl_add(card, kctl);
     2112                if (err)
    20922113                        return err;
    20932114#if 0
    2094                 if ((kctl = snd_ctl_new1(&snd_audigy_spdif_output_rate, emu)) == NULL)
     2115                kctl = snd_ctl_new1(&snd_audigy_spdif_output_rate, emu);
     2116                if (!kctl)
    20952117                        return -ENOMEM;
    2096                 if ((err = snd_ctl_add(card, kctl)))
     2118                err = snd_ctl_add(card, kctl);
     2119                if (err)
    20972120                        return err;
    20982121#endif
    20992122        } else if (! emu->card_capabilities->ecard) {
    21002123                /* sb live! */
    2101                 if ((kctl = snd_ctl_new1(&snd_emu10k1_shared_spdif, emu)) == NULL)
     2124                kctl = snd_ctl_new1(&snd_emu10k1_shared_spdif, emu);
     2125                if (!kctl)
    21022126                        return -ENOMEM;
    2103                 if ((err = snd_ctl_add(card, kctl)))
     2127                err = snd_ctl_add(card, kctl);
     2128                if (err)
    21042129                        return err;
    21052130        }
    21062131        if (emu->card_capabilities->ca0151_chip) { /* P16V */
    2107                 if ((err = snd_p16v_mixer(emu)))
     2132                err = snd_p16v_mixer(emu);
     2133                if (err)
    21082134                        return err;
    21092135        }
  • GPL/trunk/alsa-kernel/pci/emu10k1/emumpu401.c

    r679 r703  
    320320        int err;
    321321
    322         if ((err = snd_rawmidi_new(emu->card, name, device, 1, 1, &rmidi)) < 0)
     322        err = snd_rawmidi_new(emu->card, name, device, 1, 1, &rmidi);
     323        if (err < 0)
    323324                return err;
    324325        midi->emu = emu;
     
    343344        int err;
    344345
    345         if ((err = emu10k1_midi_init(emu, midi, 0, "EMU10K1 MPU-401 (UART)")) < 0)
     346        err = emu10k1_midi_init(emu, midi, 0, "EMU10K1 MPU-401 (UART)");
     347        if (err < 0)
    346348                return err;
    347349
     
    361363
    362364        midi = &emu->midi;
    363         if ((err = emu10k1_midi_init(emu, midi, 0, "Audigy MPU-401 (UART)")) < 0)
     365        err = emu10k1_midi_init(emu, midi, 0, "Audigy MPU-401 (UART)");
     366        if (err < 0)
    364367                return err;
    365368
     
    372375
    373376        midi = &emu->midi2;
    374         if ((err = emu10k1_midi_init(emu, midi, 1, "Audigy MPU-401 #2")) < 0)
     377        err = emu10k1_midi_init(emu, midi, 1, "Audigy MPU-401 #2");
     378        if (err < 0)
    375379                return err;
    376380
  • GPL/trunk/alsa-kernel/pci/emu10k1/emupcm.c

    r679 r703  
    2626        struct snd_emu10k1_pcm *epcm;
    2727
    28         if ((epcm = voice->epcm) == NULL)
     28        epcm = voice->epcm;
     29        if (!epcm)
    2930                return;
    3031        if (epcm->substream == NULL)
     
    400401        int err;
    401402
    402         if ((err = snd_emu10k1_pcm_channel_alloc(epcm, params_channels(hw_params))) < 0)
     403        err = snd_emu10k1_pcm_channel_alloc(epcm, params_channels(hw_params));
     404        if (err < 0)
    403405                return err;
    404406
     
    11251127        runtime->private_free = snd_emu10k1_pcm_free_substream;
    11261128        runtime->hw = snd_emu10k1_playback;
    1127         if ((err = snd_pcm_hw_constraint_integer(runtime, SNDRV_PCM_HW_PARAM_PERIODS)) < 0) {
     1129        err = snd_pcm_hw_constraint_integer(runtime, SNDRV_PCM_HW_PARAM_PERIODS);
     1130        if (err < 0) {
    11281131                kfree(epcm);
    11291132                return err;
    11301133        }
    1131         if ((err = snd_pcm_hw_constraint_minmax(runtime, SNDRV_PCM_HW_PARAM_BUFFER_BYTES, 256, UINT_MAX)) < 0) {
     1134        err = snd_pcm_hw_constraint_minmax(runtime, SNDRV_PCM_HW_PARAM_BUFFER_BYTES, 256, UINT_MAX);
     1135        if (err < 0) {
    11321136                kfree(epcm);
    11331137                return err;
     
    13811385        int err;
    13821386
    1383         if ((err = snd_pcm_new(emu->card, "emu10k1", device, 32, 1, &pcm)) < 0)
     1387        err = snd_pcm_new(emu->card, "emu10k1", device, 32, 1, &pcm);
     1388        if (err < 0)
    13841389                return err;
    13851390
     
    14131418        int err;
    14141419
    1415         if ((err = snd_pcm_new(emu->card, "emu10k1", device, 1, 0, &pcm)) < 0)
     1420        err = snd_pcm_new(emu->card, "emu10k1", device, 1, 0, &pcm);
     1421        if (err < 0)
    14161422                return err;
    14171423
     
    14471453        int err;
    14481454
    1449         if ((err = snd_pcm_new(emu->card, "emu10k1 mic", device, 0, 1, &pcm)) < 0)
     1455        err = snd_pcm_new(emu->card, "emu10k1 mic", device, 0, 1, &pcm);
     1456        if (err < 0)
    14501457                return err;
    14511458
     
    17751782        int err;
    17761783
    1777         if ((err = snd_pcm_new(emu->card, "emu10k1 efx", device, 8, 1, &pcm)) < 0)
     1784        err = snd_pcm_new(emu->card, "emu10k1 efx", device, 8, 1, &pcm);
     1785        if (err < 0)
    17781786                return err;
    17791787
  • GPL/trunk/alsa-kernel/pci/emu10k1/memory.c

    r695 r703  
    170170
    171171        /* calculate the expected size of empty region */
    172         if ((p = blk->mapped_link.prev) != &emu->mapped_link_head) {
     172        p = blk->mapped_link.prev;
     173        if (p != &emu->mapped_link_head) {
    173174                q = get_emu10k1_memblk(p, mapped_link);
    174175                start_page = q->mapped_page + q->pages;
    175         } else
     176        } else {
    176177                start_page = 1;
    177         if ((p = blk->mapped_link.next) != &emu->mapped_link_head) {
     178        }
     179        p = blk->mapped_link.next;
     180        if (p != &emu->mapped_link_head) {
    178181                q = get_emu10k1_memblk(p, mapped_link);
    179182                end_page = q->mapped_page;
    180         } else
     183        } else {
    181184                end_page = (emu->address_mode ? MAX_ALIGN_PAGES1 : MAX_ALIGN_PAGES0);
     185        }
    182186
    183187        /* remove links */
     
    268272                return 0;
    269273        }
    270         if ((err = map_memblk(emu, blk)) < 0) {
     274        err = map_memblk(emu, blk);
     275        if (err < 0) {
    271276                /* no enough page - try to unmap some blocks */
    272277                /* starting from the oldest block */
     
    455460        int first_page, last_page;
    456461        first_page = blk->first_page;
    457         if ((p = blk->mem.list.prev) != &hdr->block) {
     462        p = blk->mem.list.prev;
     463        if (p != &hdr->block) {
    458464                q = get_emu10k1_memblk(p, mem.list);
    459465                if (q->last_page == first_page)
     
    461467        }
    462468        last_page = blk->last_page;
    463         if ((p = blk->mem.list.next) != &hdr->block) {
     469        p = blk->mem.list.next;
     470        if (p != &hdr->block) {
    464471                q = get_emu10k1_memblk(p, mem.list);
    465472                if (q->first_page == last_page)
  • GPL/trunk/alsa-kernel/pci/emu10k1/p16v.c

    r679 r703  
    195195        /* channel->interrupt = snd_p16v_pcm_channel_interrupt; */
    196196        channel->epcm = epcm;
    197         if ((err = snd_pcm_hw_constraint_integer(runtime, SNDRV_PCM_HW_PARAM_PERIODS)) < 0)
     197        err = snd_pcm_hw_constraint_integer(runtime, SNDRV_PCM_HW_PARAM_PERIODS);
     198        if (err < 0)
    198199                return err;
    199200
     
    243244        /* channel->interrupt = snd_p16v_pcm_channel_interrupt; */
    244245        channel->epcm = epcm;
    245         if ((err = snd_pcm_hw_constraint_integer(runtime, SNDRV_PCM_HW_PARAM_PERIODS)) < 0)
     246        err = snd_pcm_hw_constraint_integer(runtime, SNDRV_PCM_HW_PARAM_PERIODS);
     247        if (err < 0)
    246248                return err;
    247249
     
    590592        emu->p16v_device_offset = device;
    591593
    592         if ((err = snd_pcm_new(emu->card, "p16v", device, 1, capture, &pcm)) < 0)
     594        err = snd_pcm_new(emu->card, "p16v", device, 1, capture, &pcm);
     595        if (err < 0)
    593596                return err;
    594597 
     
    809812
    810813        for (i = 0; i < ARRAY_SIZE(p16v_mixer_controls); i++) {
    811                 if ((err = snd_ctl_add(card, snd_ctl_new1(&p16v_mixer_controls[i],
    812                                                           emu))) < 0)
     814                err = snd_ctl_add(card, snd_ctl_new1(&p16v_mixer_controls[i], emu));
     815                if (err < 0)
    813816                        return err;
    814817        }
  • GPL/trunk/alsa-kernel/pci/emu10k1/timer.c

    r679 r703  
    7373        tid.device = device;
    7474        tid.subdevice = 0;
    75         if ((err = snd_timer_new(emu->card, "EMU10K1", &tid, &timer)) >= 0) {
     75        err = snd_timer_new(emu->card, "EMU10K1", &tid, &timer);
     76        if (err >= 0) {
    7677                strcpy(timer->name, "EMU10K1 timer");
    7778                timer->private_data = emu;
  • GPL/trunk/alsa-kernel/pci/ens1370.c

    r695 r703  
    676676                        /* now wait for the stinkin' data (RDY) */
    677677                        for (t = 0; t < POLL_COUNT; t++) {
    678                                 if ((x = inl(ES_REG(ensoniq, 1371_CODEC))) & ES_1371_CODEC_RDY) {
     678                                x = inl(ES_REG(ensoniq, 1371_CODEC));
     679                                if (x & ES_1371_CODEC_RDY) {
    679680                                        if (is_ev1938(ensoniq)) {
    680681                                                for (t = 0; t < 100; t++)
     
    15981599        };
    15991600
    1600         if ((err = snd_ac97_bus(card, 0, &ops, NULL, &pbus)) < 0)
     1601        err = snd_ac97_bus(card, 0, &ops, NULL, &pbus);
     1602        if (err < 0)
    16011603                return err;
    16021604
     
    16061608        ac97.pci = ensoniq->pci;
    16071609        ac97.scaps = AC97_SCAP_AUDIO;
    1608         if ((err = snd_ac97_mixer(pbus, &ac97, &ensoniq->u.es1371.ac97)) < 0)
     1610        err = snd_ac97_mixer(pbus, &ac97, &ensoniq->u.es1371.ac97);
     1611        if (err < 0)
    16091612                return err;
    16101613        if (has_spdif > 0 ||
     
    17261729        ak4531.private_data = ensoniq;
    17271730        ak4531.private_free = snd_ensoniq_mixer_free_ak4531;
    1728         if ((err = snd_ak4531_mixer(card, &ak4531, &ensoniq->u.es1370.ak4531)) < 0)
     1731        err = snd_ak4531_mixer(card, &ak4531, &ensoniq->u.es1370.ak4531);
     1732        if (err < 0)
    17291733                return err;
    17301734        for (idx = 0; idx < ES1370_CONTROLS; idx++) {
     
    20422046
    20432047        *rensoniq = NULL;
    2044         if ((err = pci_enable_device(pci)) < 0)
     2048        err = pci_enable_device(pci);
     2049        if (err < 0)
    20452050                return err;
    20462051        ensoniq = kzalloc(sizeof(*ensoniq), GFP_KERNEL);
     
    20542059        ensoniq->pci = pci;
    20552060        ensoniq->irq = -1;
    2056         if ((err = pci_request_regions(pci, "Ensoniq AudioPCI")) < 0) {
     2061        err = pci_request_regions(pci, "Ensoniq AudioPCI");
     2062        if (err < 0) {
    20572063                kfree(ensoniq);
    20582064                pci_disable_device(pci);
     
    21032109        snd_ensoniq_chip_init(ensoniq);
    21042110
    2105         if ((err = snd_device_new(card, SNDRV_DEV_LOWLEVEL, ensoniq, &ops)) < 0) {
     2111        err = snd_device_new(card, SNDRV_DEV_LOWLEVEL, ensoniq, &ops);
     2112        if (err < 0) {
    21062113                snd_ensoniq_free(ensoniq);
    21072114                return err;
     
    22942301        int err;
    22952302
    2296         if ((err = snd_rawmidi_new(ensoniq->card, "ES1370/1", device, 1, 1, &rmidi)) < 0)
     2303        err = snd_rawmidi_new(ensoniq->card, "ES1370/1", device, 1, 1, &rmidi);
     2304        if (err < 0)
    22972305                return err;
    22982306        strcpy(rmidi->name, CHIP_NAME);
     
    23652373                return err;
    23662374
    2367         if ((err = snd_ensoniq_create(card, pci, &ensoniq)) < 0) {
     2375        err = snd_ensoniq_create(card, pci, &ensoniq);
     2376        if (err < 0) {
    23682377                snd_card_free(card);
    23692378                return err;
     
    23722381
    23732382#ifdef CHIP1370
    2374         if ((err = snd_ensoniq_1370_mixer(ensoniq)) < 0) {
     2383        err = snd_ensoniq_1370_mixer(ensoniq);
     2384        if (err < 0) {
    23752385                snd_card_free(card);
    23762386                return err;
     
    23782388#endif
    23792389#ifdef CHIP1371
    2380         if ((err = snd_ensoniq_1371_mixer(ensoniq, spdif[dev], lineio[dev])) < 0) {
     2390        err = snd_ensoniq_1371_mixer(ensoniq, spdif[dev], lineio[dev]);
     2391        if (err < 0) {
    23812392                snd_card_free(card);
    23822393                return err;
    23832394        }
    23842395#endif
    2385         if ((err = snd_ensoniq_pcm(ensoniq, 0)) < 0) {
     2396        err = snd_ensoniq_pcm(ensoniq, 0);
     2397        if (err < 0) {
    23862398                snd_card_free(card);
    23872399                return err;
    23882400        }
    2389         if ((err = snd_ensoniq_pcm2(ensoniq, 1)) < 0) {
     2401        err = snd_ensoniq_pcm2(ensoniq, 1);
     2402        if (err < 0) {
    23902403                snd_card_free(card);
    23912404                return err;
    23922405        }
    2393         if ((err = snd_ensoniq_midi(ensoniq, 0)) < 0) {
     2406        err = snd_ensoniq_midi(ensoniq, 0);
     2407        if (err < 0) {
    23942408                snd_card_free(card);
    23952409                return err;
     
    24072421                ensoniq->irq);
    24082422
    2409         if ((err = snd_card_register(card)) < 0) {
     2423        err = snd_card_register(card);
     2424        if (err < 0) {
    24102425                snd_card_free(card);
    24112426                return err;
  • GPL/trunk/alsa-kernel/pci/es1938.c

    r695 r703  
    297297        unsigned char v;
    298298        for (i = 0; i < WRITE_LOOP_TIMEOUT; i++) {
    299                 if (!(v = inb(SLSB_REG(chip, READSTATUS)) & 0x80)) {
     299                v = inb(SLSB_REG(chip, READSTATUS));
     300                if (!(v & 0x80)) {
    300301                        outb(cmd, SLSB_REG(chip, WRITEDATA));
    301302                        return;
     
    313314        int i;
    314315        unsigned char v;
    315         for (i = GET_LOOP_TIMEOUT; i; i--)
    316                 if ((v = inb(SLSB_REG(chip, STATUS))) & 0x80)
     316        for (i = GET_LOOP_TIMEOUT; i; i--) {
     317                v = inb(SLSB_REG(chip, STATUS));
     318                if (v & 0x80)
    317319                        return inb(SLSB_REG(chip, READDATA));
     320        }
    318321        dev_err(chip->card->dev, "get_byte timeout: status 0x02%x\n", v);
    319322        return -ENODEV;
     
    9971000        int err;
    9981001
    999         if ((err = snd_pcm_new(chip->card, "es-1938-1946", device, 2, 1, &pcm)) < 0)
     1002        err = snd_pcm_new(chip->card, "es-1938-1946", device, 2, 1, &pcm);
     1003        if (err < 0)
    10001004                return err;
    10011005        snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_PLAYBACK, &snd_es1938_playback_ops);
     
    15891593
    15901594        /* enable PCI device */
    1591         if ((err = pci_enable_device(pci)) < 0)
     1595        err = pci_enable_device(pci);
     1596        if (err < 0)
    15921597                return err;
    15931598        /* check, if we can restrict PCI DMA transfers to 24 bits */
     
    16091614        chip->pci = pci;
    16101615        chip->irq = -1;
    1611         if ((err = pci_request_regions(pci, "ESS Solo-1")) < 0) {
     1616        err = pci_request_regions(pci, "ESS Solo-1");
     1617        if (err < 0) {
    16121618                kfree(chip);
    16131619                pci_disable_device(pci);
     
    16351641        snd_es1938_chip_init(chip);
    16361642
    1637         if ((err = snd_device_new(card, SNDRV_DEV_LOWLEVEL, chip, &ops)) < 0) {
     1643        err = snd_device_new(card, SNDRV_DEV_LOWLEVEL, chip, &ops);
     1644        if (err < 0) {
    16381645                snd_es1938_free(chip);
    16391646                return err;
     
    17671774                                break;
    17681775                        }
    1769                 if ((err = snd_ctl_add(card, kctl)) < 0)
     1776                err = snd_ctl_add(card, kctl);
     1777                if (err < 0)
    17701778                        return err;
    17711779        }
     
    18011809                }
    18021810        }
    1803         if ((err = snd_es1938_create(card, pci, &chip)) < 0) {
     1811        err = snd_es1938_create(card, pci, &chip);
     1812        if (err < 0) {
    18041813                snd_card_free(card);
    18051814                return err;
     
    18141823                chip->irq);
    18151824
    1816         if ((err = snd_es1938_new_pcm(chip, 0)) < 0) {
     1825        err = snd_es1938_new_pcm(chip, 0);
     1826        if (err < 0) {
    18171827                snd_card_free(card);
    18181828                return err;
    18191829        }
    1820         if ((err = snd_es1938_mixer(chip)) < 0) {
     1830        err = snd_es1938_mixer(chip);
     1831        if (err < 0) {
    18211832                snd_card_free(card);
    18221833                return err;
     
    18291840                           SLSB_REG(chip, FMLOWADDR));
    18301841        } else {
    1831                 if ((err = snd_opl3_timer_new(opl3, 0, 1)) < 0) {
     1842                err = snd_opl3_timer_new(opl3, 0, 1);
     1843                if (err < 0) {
    18321844                        snd_card_free(card);
    18331845                        return err;
    18341846                }
    1835                 if ((err = snd_opl3_hwdep_new(opl3, 0, 1, NULL)) < 0) {
     1847                err = snd_opl3_hwdep_new(opl3, 0, 1, NULL);
     1848                if (err < 0) {
    18361849                        snd_card_free(card);
    18371850                        return err;
     
    18511864        snd_es1938_create_gameport(chip);
    18521865
    1853         if ((err = snd_card_register(card)) < 0) {
     1866        err = snd_card_register(card);
     1867        if (err < 0) {
    18541868                snd_card_free(card);
    18551869                return err;
  • GPL/trunk/alsa-kernel/pci/es1968.c

    r695 r703  
    16161616
    16171617        /* get mixbuffer */
    1618         if ((es->mixbuf = snd_es1968_new_memory(chip, ESM_MIXBUF_SIZE)) == NULL) {
     1618        es->mixbuf = snd_es1968_new_memory(chip, ESM_MIXBUF_SIZE);
     1619        if (!es->mixbuf) {
    16191620                snd_es1968_free_apu_pair(chip, apu1);
    16201621                snd_es1968_free_apu_pair(chip, apu2);
     
    17151716
    17161717        /* search 2 APUs (although one apu is enough) */
    1717         if ((apu = snd_es1968_alloc_apu_pair(chip, ESM_APU_PCM_PLAY)) < 0) {
     1718        apu = snd_es1968_alloc_apu_pair(chip, ESM_APU_PCM_PLAY);
     1719        if (apu < 0) {
    17181720                dev_err(chip->card->dev, "Hmm, cannot find empty APU pair!?\n");
    17191721                return;
    17201722        }
    1721         if ((memory = snd_es1968_new_memory(chip, CLOCK_MEASURE_BUFSIZE)) == NULL) {
     1723        memory = snd_es1968_new_memory(chip, CLOCK_MEASURE_BUFSIZE);
     1724        if (!memory) {
    17221725                dev_warn(chip->card->dev,
    17231726                         "cannot allocate dma buffer - using default clock %d\n",
     
    18281831
    18291832        /* get DMA buffer */
    1830         if ((err = snd_es1968_init_dmabuf(chip)) < 0)
     1833        err = snd_es1968_init_dmabuf(chip);
     1834        if (err < 0)
    18311835                return err;
    18321836
     
    18371841        wave_set_register(chip, 0x01FF, chip->dma.addr >> 12);
    18381842
    1839         if ((err = snd_pcm_new(chip->card, "ESS Maestro", device,
    1840                                chip->playback_streams,
    1841                                chip->capture_streams, &pcm)) < 0)
     1843        err = snd_pcm_new(chip->card, "ESS Maestro", device,
     1844                          chip->playback_streams,
     1845                          chip->capture_streams, &pcm);
     1846        if (err < 0)
    18421847                return err;
    18431848
     
    19901995        u32 event;
    19911996
    1992         if (!(event = inb(chip->io_port + 0x1A)))
     1997        event = inb(chip->io_port + 0x1A);
     1998        if (!event)
    19931999                return IRQ_NONE;
    19942000
     
    20452051        };
    20462052
    2047         if ((err = snd_ac97_bus(chip->card, 0, &ops, NULL, &pbus)) < 0)
     2053        err = snd_ac97_bus(chip->card, 0, &ops, NULL, &pbus);
     2054        if (err < 0)
    20482055                return err;
    20492056        pbus->no_vra = 1; /* ES1968 doesn't need VRA */
     
    20512058        memset(&ac97, 0, sizeof(ac97));
    20522059        ac97.private_data = chip;
    2053         if ((err = snd_ac97_mixer(pbus, &ac97, &chip->ac97)) < 0)
     2060        err = snd_ac97_mixer(pbus, &ac97, &chip->ac97);
     2061        if (err < 0)
    20542062                return err;
    20552063
     
    26982706
    26992707        /* enable PCI device */
    2700         if ((err = pci_enable_device(pci)) < 0)
     2708        err = pci_enable_device(pci);
     2709        if (err < 0)
    27012710                return err;
    27022711        /* check, if we can restrict PCI DMA transfers to 28 bits */
     
    27292738        chip->capture_streams = capt_streams;
    27302739
    2731         if ((err = pci_request_regions(pci, "ESS Maestro")) < 0) {
     2740        err = pci_request_regions(pci, "ESS Maestro");
     2741        if (err < 0) {
    27322742                kfree(chip);
    27332743                pci_disable_device(pci);
     
    27762786        snd_es1968_chip_init(chip);
    27772787
    2778         if ((err = snd_device_new(card, SNDRV_DEV_LOWLEVEL, chip, &ops)) < 0) {
     2788        err = snd_device_new(card, SNDRV_DEV_LOWLEVEL, chip, &ops);
     2789        if (err < 0) {
    27792790                snd_es1968_free(chip);
    27802791                return err;
     
    28412852        if (total_bufsize[dev] > 4096)
    28422853                total_bufsize[dev] = 4096;
    2843         if ((err = snd_es1968_create(card, pci,
    2844                                      total_bufsize[dev] * 1024, /* in bytes */
    2845                                      pcm_substreams_p[dev],
    2846                                      pcm_substreams_c[dev],
    2847                                      pci_id->driver_data,
    2848                                      use_pm[dev],
    2849                                      radio_nr[dev],
    2850                                      &chip)) < 0) {
     2854        err = snd_es1968_create(card, pci,
     2855                                total_bufsize[dev] * 1024, /* in bytes */
     2856                                pcm_substreams_p[dev],
     2857                                pcm_substreams_c[dev],
     2858                                pci_id->driver_data,
     2859                                use_pm[dev],
     2860                                radio_nr[dev],
     2861                                &chip);
     2862        if (err < 0) {
    28512863                snd_card_free(card);
    28522864                return err;
     
    28692881        }
    28702882
    2871         if ((err = snd_es1968_pcm(chip, 0)) < 0) {
     2883        err = snd_es1968_pcm(chip, 0);
     2884        if (err < 0) {
    28722885                snd_card_free(card);
    28732886                return err;
    28742887        }
    28752888
    2876         if ((err = snd_es1968_mixer(chip)) < 0) {
     2889        err = snd_es1968_mixer(chip);
     2890        if (err < 0) {
    28772891                snd_card_free(card);
    28782892                return err;
     
    28922906        }
    28932907        if (enable_mpu[dev]) {
    2894                 if ((err = snd_mpu401_uart_new(card, 0, MPU401_HW_MPU401,
    2895                                                chip->io_port + ESM_MPU401_PORT,
    2896                                                MPU401_INFO_INTEGRATED |
    2897                                                MPU401_INFO_IRQ_HOOK,
    2898                                                -1, &chip->rmidi)) < 0) {
     2908                err = snd_mpu401_uart_new(card, 0, MPU401_HW_MPU401,
     2909                                          chip->io_port + ESM_MPU401_PORT,
     2910                                          MPU401_INFO_INTEGRATED |
     2911                                          MPU401_INFO_IRQ_HOOK,
     2912                                          -1, &chip->rmidi);
     2913                if (err < 0)
    28992914                        dev_warn(card->dev, "skipping MPU-401 MIDI support..\n");
    2900                 }
    29012915        }
    29022916
     
    29192933                card->shortname, chip->io_port, chip->irq);
    29202934
    2921         if ((err = snd_card_register(card)) < 0) {
     2935        err = snd_card_register(card);
     2936        if (err < 0) {
    29222937                snd_card_free(card);
    29232938                return err;
  • GPL/trunk/alsa-kernel/pci/fm801.c

    r695 r703  
    668668                                           &hw_constraints_channels);
    669669        }
    670         if ((err = snd_pcm_hw_constraint_integer(runtime, SNDRV_PCM_HW_PARAM_PERIODS)) < 0)
     670        err = snd_pcm_hw_constraint_integer(runtime, SNDRV_PCM_HW_PARAM_PERIODS);
     671        if (err < 0)
    671672                return err;
    672673        return 0;
     
    683684        snd_pcm_hw_constraint_list(runtime, 0, SNDRV_PCM_HW_PARAM_RATE,
    684685                                   &hw_constraints_rates);
    685         if ((err = snd_pcm_hw_constraint_integer(runtime, SNDRV_PCM_HW_PARAM_PERIODS)) < 0)
     686        err = snd_pcm_hw_constraint_integer(runtime, SNDRV_PCM_HW_PARAM_PERIODS);
     687        if (err < 0)
    686688                return err;
    687689        return 0;
     
    726728        int err;
    727729
    728         if ((err = snd_pcm_new(chip->card, "FM801", device, 1, 1, &pcm)) < 0)
     730        err = snd_pcm_new(chip->card, "FM801", device, 1, 1, &pcm);
     731        if (err < 0)
    729732                return err;
    730733
     
    994997        unsigned short val;
    995998 
    996         if ((val = ucontrol->value.enumerated.item[0]) > 4)
     999        val = ucontrol->value.enumerated.item[0];
     1000        if (val > 4)
    9971001                return -EINVAL;
    9981002        return snd_fm801_update_bits(chip, FM801_REC_SRC, 7, val);
     
    10591063        };
    10601064
    1061         if ((err = snd_ac97_bus(chip->card, 0, &ops, chip, &chip->ac97_bus)) < 0)
     1065        err = snd_ac97_bus(chip->card, 0, &ops, chip, &chip->ac97_bus);
     1066        if (err < 0)
    10621067                return err;
    10631068        chip->ac97_bus->private_free = snd_fm801_mixer_free_ac97_bus;
     
    10661071        ac97.private_data = chip;
    10671072        ac97.private_free = snd_fm801_mixer_free_ac97;
    1068         if ((err = snd_ac97_mixer(chip->ac97_bus, &ac97, &chip->ac97)) < 0)
     1073        err = snd_ac97_mixer(chip->ac97_bus, &ac97, &chip->ac97);
     1074        if (err < 0)
    10691075                return err;
    10701076        if (chip->secondary) {
    10711077                ac97.num = 1;
    10721078                ac97.addr = chip->secondary_addr;
    1073                 if ((err = snd_ac97_mixer(chip->ac97_bus, &ac97, &chip->ac97_sec)) < 0)
     1079                err = snd_ac97_mixer(chip->ac97_bus, &ac97, &chip->ac97_sec);
     1080                if (err < 0)
    10741081                        return err;
    10751082        }
     
    12231230        *rchip = NULL;
    12241231#ifndef TARGET_OS2
    1225         if ((err = pcim_enable_device(pci)) < 0)
     1232        err = pcim_enable_device(pci);
     1233        if (err < 0)
    12261234                return err;
    12271235        chip = devm_kzalloc(&pci->dev, sizeof(*chip), GFP_KERNEL);
     
    12381246        chip->irq = -1;
    12391247        chip->tea575x_tuner = tea575x_tuner;
    1240         if ((err = pci_request_regions(pci, "FM801")) < 0)
     1248        err = pci_request_regions(pci, "FM801");
     1249        if (err < 0)
    12411250                return err;
    12421251        chip->port = pci_resource_start(pci, 0);
     
    12781287        snd_fm801_chip_init(chip);
    12791288
    1280         if ((err = snd_device_new(card, SNDRV_DEV_LOWLEVEL, chip, &ops)) < 0) {
     1289        err = snd_device_new(card, SNDRV_DEV_LOWLEVEL, chip, &ops);
     1290        if (err < 0) {
    12811291                snd_fm801_free(chip);
    12821292                return err;
     
    13511361        if (err < 0)
    13521362                return err;
    1353         if ((err = snd_fm801_create(card, pci, tea575x_tuner[dev], radio_nr[dev], &chip)) < 0) {
     1363        err = snd_fm801_create(card, pci, tea575x_tuner[dev], radio_nr[dev], &chip);
     1364        if (err < 0) {
    13541365                snd_card_free(card);
    13551366                return err;
     
    13661377                goto __fm801_tuner_only;
    13671378
    1368         if ((err = snd_fm801_pcm(chip, 0)) < 0) {
     1379        err = snd_fm801_pcm(chip, 0);
     1380        if (err < 0) {
    13691381                snd_card_free(card);
    13701382                return err;
    13711383        }
    1372         if ((err = snd_fm801_mixer(chip)) < 0) {
     1384        err = snd_fm801_mixer(chip);
     1385        if (err < 0) {
    13731386                snd_card_free(card);
    13741387                return err;
    13751388        }
    1376         if ((err = snd_mpu401_uart_new(card, 0, MPU401_HW_FM801,
    1377                                        chip->port + FM801_MPU401_DATA,
    1378                                        MPU401_INFO_INTEGRATED |
    1379                                        MPU401_INFO_IRQ_HOOK,
    1380                                        -1, &chip->rmidi)) < 0) {
     1389        err = snd_mpu401_uart_new(card, 0, MPU401_HW_FM801,
     1390                                  chip->port + FM801_MPU401_DATA,
     1391                                  MPU401_INFO_INTEGRATED |
     1392                                  MPU401_INFO_IRQ_HOOK,
     1393                                  -1, &chip->rmidi);
     1394        if (err < 0) {
    13811395                snd_card_free(card);
    13821396                return err;
    13831397        }
    1384         if ((err = snd_opl3_create(card, chip->port + FM801_OPL3_BANK0,
    1385                                    chip->port + FM801_OPL3_BANK1,
    1386                                    OPL3_HW_OPL3_FM801, 1, &opl3)) < 0) {
     1398        err = snd_opl3_create(card, chip->port + FM801_OPL3_BANK0,
     1399                              chip->port + FM801_OPL3_BANK1,
     1400                              OPL3_HW_OPL3_FM801, 1, &opl3);
     1401        if (err < 0) {
    13871402                snd_card_free(card);
    13881403                return err;
    13891404        }
    1390         if ((err = snd_opl3_hwdep_new(opl3, 0, 1, NULL)) < 0) {
     1405        err = snd_opl3_hwdep_new(opl3, 0, 1, NULL);
     1406        if (err < 0) {
    13911407                snd_card_free(card);
    13921408                return err;
     
    13941410
    13951411      __fm801_tuner_only:
    1396         if ((err = snd_card_register(card)) < 0) {
     1412        err = snd_card_register(card);
     1413        if (err < 0) {
    13971414                snd_card_free(card);
    13981415                return err;
  • GPL/trunk/alsa-kernel/pci/hda/hda_bind.c

    r689 r703  
    170170        struct hda_codec *codec = dev_to_hda_codec(dev);
    171171
    172         if (!pm_runtime_suspended(dev) && codec->patch_ops.reboot_notify)
    173                 codec->patch_ops.reboot_notify(codec);
     172        if (!pm_runtime_suspended(dev)) {
     173                if (codec->patch_ops.reboot_notify)
     174                        codec->patch_ops.reboot_notify(codec);
     175                snd_hda_codec_display_power(codec, false);
     176        }
    174177}
    175178
  • GPL/trunk/alsa-kernel/pci/hda/hda_codec.c

    r695 r703  
    809809
    810810/* enable/disable display power per codec */
    811 static void codec_display_power(struct hda_codec *codec, bool enable)
     811void snd_hda_codec_display_power(struct hda_codec *codec, bool enable)
    812812{
    813813        if (codec->display_power_control)
     
    821821                return;
    822822        if (device_is_registered(hda_codec_dev(codec))) {
    823                 codec_display_power(codec, true);
     823                snd_hda_codec_display_power(codec, true);
    824824                pm_runtime_enable(hda_codec_dev(codec));
    825825                /* it was powered up in snd_hda_codec_new(), now all done */
     
    847847        if (codec->core.type == HDA_DEV_LEGACY)
    848848                snd_hdac_device_unregister(&codec->core);
    849         codec_display_power(codec, false);
     849        snd_hda_codec_display_power(codec, false);
    850850
    851851        /*
     
    29092909             (state & AC_PWRST_CLK_STOP_OK)))
    29102910                snd_hdac_codec_link_down(&codec->core);
    2911         codec_display_power(codec, false);
     2911        snd_hda_codec_display_power(codec, false);
    29122912        return 0;
    29132913}
     
    29212921                return 0;
    29222922
    2923         codec_display_power(codec, true);
     2923        snd_hda_codec_display_power(codec, true);
    29242924        snd_hdac_codec_link_up(&codec->core);
    29252925        hda_call_codec_resume(codec);
  • GPL/trunk/alsa-kernel/pci/hda/hda_generic.c

    r695 r703  
    14371437                }
    14381438                if (!path) {
    1439                         dac = dacs[i] = 0;
     1439                        dacs[i] = 0;
    14401440                        badness += bad->no_dac;
    14411441                } else {
     
    34723472        const struct hda_input_mux *imux;
    34733473        struct nid_path *path;
    3474         int i, adc_idx, err = 0;
     3474        int i, adc_idx, ret, err = 0;
    34753475
    34763476        imux = &spec->input_mux;
     
    34823482                        continue;
    34833483                kcontrol->private_value = path->ctls[type];
    3484                 err = func(kcontrol, ucontrol);
    3485                 if (err < 0)
     3484                ret = func(kcontrol, ucontrol);
     3485                if (ret < 0) {
     3486                        err = ret;
    34863487                        break;
     3488                }
     3489                if (ret > 0)
     3490                        err = 1;
    34873491        }
    34883492        mutex_unlock(&codec->control_mutex);
  • GPL/trunk/alsa-kernel/pci/hda/hda_intel.c

    r695 r703  
    909909}
    910910
     911static void __azx_shutdown_chip(struct azx *chip, bool skip_link_reset)
     912{
     913        azx_stop_chip(chip);
     914        if (!skip_link_reset)
     915                azx_enter_link_reset(chip);
     916        azx_clear_irq_pending(chip);
     917        display_power(chip, false);
     918}
     919
    911920#ifdef CONFIG_PM
    912921static DEFINE_MUTEX(card_list_lock);
    913922static LIST_HEAD(card_list);
     923
     924static void azx_shutdown_chip(struct azx *chip)
     925{
     926        __azx_shutdown_chip(chip, false);
     927}
    914928
    915929static void azx_add_card_list(struct azx *chip)
     
    970984}
    971985
    972 static void __azx_runtime_suspend(struct azx *chip)
    973 {
    974         azx_stop_chip(chip);
    975         azx_enter_link_reset(chip);
    976         azx_clear_irq_pending(chip);
    977         display_power(chip, false);
    978 }
    979 
    980986static void __azx_runtime_resume(struct azx *chip)
    981987{
     
    10561062        chip = card->private_data;
    10571063        bus = azx_bus(chip);
    1058         __azx_runtime_suspend(chip);
     1064        azx_shutdown_chip(chip);
    10591065        if (bus->irq >= 0) {
    10601066                free_irq(bus->irq, chip);
     
    11361142        azx_writew(chip, WAKEEN, azx_readw(chip, WAKEEN) | STATESTS_INT_MASK);
    11371143
    1138         __azx_runtime_suspend(chip);
     1144        azx_shutdown_chip(chip);
    11391145        trace_azx_runtime_suspend(chip);
    11401146        return 0;
     
    24352441        chip = card->private_data;
    24362442        if (chip && chip->running)
    2437                 azx_stop_chip(chip);
     2443                __azx_shutdown_chip(chip, true);
    24382444}
    24392445
  • GPL/trunk/alsa-kernel/pci/hda/hda_local.h

    r695 r703  
    724724void snd_print_channel_allocation(int spk_alloc, char *buf, int buflen);
    725725
     726void snd_hda_codec_display_power(struct hda_codec *codec, bool enable);
     727
    726728/*
    727729 */
  • GPL/trunk/alsa-kernel/pci/hda/hda_tegra.c

    r695 r703  
    236236        struct hda_tegra *hda = container_of(chip, struct hda_tegra, chip);
    237237        struct hdac_bus *bus = azx_bus(chip);
    238         struct device *dev = hda->dev;
    239238        struct resource *res;
    240239
    241         res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
    242         hda->regs = devm_ioremap_resource(dev, res);
     240        hda->regs = devm_platform_get_and_ioremap_resource(pdev, 0, &res);
    243241        if (IS_ERR(hda->regs))
    244242                return PTR_ERR(hda->regs);
  • GPL/trunk/alsa-kernel/pci/hda/patch_ca0132.c

    r695 r703  
    76977697static void ca0132_alt_start_dsp_audio_streams(struct hda_codec *codec)
    76987698{
    7699         const unsigned int dsp_dma_stream_ids[] = { 0x0c, 0x03, 0x04 };
     7699        static const unsigned int dsp_dma_stream_ids[] = { 0x0c, 0x03, 0x04 };
    77007700        struct ca0132_spec *spec = codec->spec;
    77017701        unsigned int i, tmp;
  • GPL/trunk/alsa-kernel/pci/hda/patch_hdmi.c

    r695 r703  
    19491949        SND_PCI_QUIRK(0x103c, 0x871a, "HP", 1),
    19501950        SND_PCI_QUIRK(0x1462, 0xec94, "MS-7C94", 1),
     1951        SND_PCI_QUIRK(0x8086, 0x2081, "Intel NUC 10", 1),
    19511952        {}
    19521953};
  • GPL/trunk/alsa-kernel/pci/hda/patch_realtek.c

    r695 r703  
    36973697        ALC269_TYPE_ALC215,
    36983698        ALC269_TYPE_ALC225,
     3699        ALC269_TYPE_ALC287,
    36993700        ALC269_TYPE_ALC294,
    37003701        ALC269_TYPE_ALC300,
     
    37333734        case ALC269_TYPE_ALC215:
    37343735        case ALC269_TYPE_ALC225:
     3736        case ALC269_TYPE_ALC287:
    37353737        case ALC269_TYPE_ALC294:
    37363738        case ALC269_TYPE_ALC300:
     
    42054207}
    42064208
     4209static void alc285_hp_init(struct hda_codec *codec)
     4210{
     4211        struct alc_spec *spec = codec->spec;
     4212        hda_nid_t hp_pin = alc_get_hp_pin(spec);
     4213        int i, val;
     4214        int coef38, coef0d, coef36;
     4215
     4216        alc_update_coef_idx(codec, 0x4a, 1<<15, 1<<15); /* Reset HP JD */
     4217        coef38 = alc_read_coef_idx(codec, 0x38); /* Amp control */
     4218        coef0d = alc_read_coef_idx(codec, 0x0d); /* Digital Misc control */
     4219        coef36 = alc_read_coef_idx(codec, 0x36); /* Passthrough Control */
     4220        alc_update_coef_idx(codec, 0x38, 1<<4, 0x0);
     4221        alc_update_coef_idx(codec, 0x0d, 0x110, 0x0);
     4222
     4223        alc_update_coef_idx(codec, 0x67, 0xf000, 0x3000);
     4224
     4225        if (hp_pin)
     4226                snd_hda_codec_write(codec, hp_pin, 0,
     4227                            AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
     4228
     4229        msleep(130);
     4230        alc_update_coef_idx(codec, 0x36, 1<<14, 1<<14);
     4231        alc_update_coef_idx(codec, 0x36, 1<<13, 0x0);
     4232
     4233        if (hp_pin)
     4234                snd_hda_codec_write(codec, hp_pin, 0,
     4235                            AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
     4236        msleep(10);
     4237        alc_write_coef_idx(codec, 0x67, 0x0); /* Set HP depop to manual mode */
     4238        alc_write_coefex_idx(codec, 0x58, 0x00, 0x7880);
     4239        alc_write_coefex_idx(codec, 0x58, 0x0f, 0xf049);
     4240        alc_update_coefex_idx(codec, 0x58, 0x03, 0x00f0, 0x00c0);
     4241
     4242        alc_write_coefex_idx(codec, 0x58, 0x00, 0xf888); /* HP depop procedure start */
     4243        val = alc_read_coefex_idx(codec, 0x58, 0x00);
     4244        for (i = 0; i < 20 && val & 0x8000; i++) {
     4245                msleep(50);
     4246                val = alc_read_coefex_idx(codec, 0x58, 0x00);
     4247        } /* Wait for depop procedure finish  */
     4248
     4249        alc_write_coefex_idx(codec, 0x58, 0x00, val); /* write back the result */
     4250        alc_update_coef_idx(codec, 0x38, 1<<4, coef38);
     4251        alc_update_coef_idx(codec, 0x0d, 0x110, coef0d);
     4252        alc_update_coef_idx(codec, 0x36, 3<<13, coef36);
     4253
     4254        msleep(50);
     4255        alc_update_coef_idx(codec, 0x4a, 1<<15, 0);
     4256}
     4257
    42074258static void alc225_init(struct hda_codec *codec)
    42084259{
     
    42104261        hda_nid_t hp_pin = alc_get_hp_pin(spec);
    42114262        bool hp1_pin_sense, hp2_pin_sense;
     4263
     4264        if (spec->codec_variant != ALC269_TYPE_ALC287)
     4265                /* required only at boot or S3 and S4 resume time */
     4266#ifndef TARGET_OS2
     4267                if (!spec->done_hp_init ||
     4268                        is_s3_resume(codec) ||
     4269                        is_s4_resume(codec)) {
     4270#else
     4271                if (!spec->done_hp_init ) {
     4272
     4273#endif
     4274                        alc285_hp_init(codec);
     4275                        spec->done_hp_init = true;
     4276                }
    42124277
    42134278        if (!hp_pin)
     
    72897354        ALC623_FIXUP_LENOVO_THINKSTATION_P340,
    72907355        ALC255_FIXUP_ACER_HEADPHONE_AND_MIC,
     7356        ALC236_FIXUP_HP_LIMIT_INT_MIC_BOOST,
    72917357};
    72927358
     
    91849250        },
    91859251#endif
     9252        [ALC236_FIXUP_HP_LIMIT_INT_MIC_BOOST] = {
     9253                .type = HDA_FIXUP_FUNC,
     9254                .v.func = alc269_fixup_limit_int_mic_boost,
     9255                .chained = true,
     9256                .chain_id = ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF,
     9257        },
    91869258};
    91879259
     
    92749346        SND_PCI_QUIRK(0x1028, 0x0a30, "Dell", ALC236_FIXUP_DELL_AIO_HEADSET_MIC),
    92759347        SND_PCI_QUIRK(0x1028, 0x0a58, "Dell", ALC255_FIXUP_DELL_HEADSET_MIC),
     9348        SND_PCI_QUIRK(0x1028, 0x0a61, "Dell XPS 15 9510", ALC289_FIXUP_DUAL_SPK),
    92769349        SND_PCI_QUIRK(0x1028, 0x164a, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
    92779350        SND_PCI_QUIRK(0x1028, 0x164b, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
     
    93729445        SND_PCI_QUIRK(0x103c, 0x87f4, "HP", ALC287_FIXUP_HP_GPIO_LED),
    93739446        SND_PCI_QUIRK(0x103c, 0x87f5, "HP", ALC287_FIXUP_HP_GPIO_LED),
     9447        SND_PCI_QUIRK(0x103c, 0x87f6, "HP Spectre x360 14", ALC245_FIXUP_HP_X360_AMP),
    93749448        SND_PCI_QUIRK(0x103c, 0x87f7, "HP Spectre x360 14", ALC245_FIXUP_HP_X360_AMP),
     9449        SND_PCI_QUIRK(0x103c, 0x8805, "HP ProBook 650 G8 Notebook PC", ALC236_FIXUP_HP_GPIO_LED),
    93759450        SND_PCI_QUIRK(0x103c, 0x880d, "HP EliteBook 830 G8 Notebook PC", ALC285_FIXUP_HP_GPIO_LED),
    93769451        SND_PCI_QUIRK(0x103c, 0x8846, "HP EliteBook 850 G8 Notebook PC", ALC285_FIXUP_HP_GPIO_LED),
     
    93789453        SND_PCI_QUIRK(0x103c, 0x884b, "HP EliteBook 840 Aero G8 Notebook PC", ALC285_FIXUP_HP_GPIO_LED),
    93799454        SND_PCI_QUIRK(0x103c, 0x884c, "HP EliteBook 840 G8 Notebook PC", ALC285_FIXUP_HP_GPIO_LED),
    9380         SND_PCI_QUIRK(0x103c, 0x8862, "HP ProBook 445 G8 Notebook PC", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
    9381         SND_PCI_QUIRK(0x103c, 0x8863, "HP ProBook 445 G8 Notebook PC", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
     9455        SND_PCI_QUIRK(0x103c, 0x8862, "HP ProBook 445 G8 Notebook PC", ALC236_FIXUP_HP_LIMIT_INT_MIC_BOOST),
     9456        SND_PCI_QUIRK(0x103c, 0x8863, "HP ProBook 445 G8 Notebook PC", ALC236_FIXUP_HP_LIMIT_INT_MIC_BOOST),
    93829457        SND_PCI_QUIRK(0x103c, 0x886d, "HP ZBook Fury 17.3 Inch G8 Mobile Workstation PC", ALC285_FIXUP_HP_GPIO_AMP_INIT),
    93839458        SND_PCI_QUIRK(0x103c, 0x8870, "HP ZBook Fury 15.6 Inch G8 Mobile Workstation PC", ALC285_FIXUP_HP_GPIO_AMP_INIT),
     
    94079482        SND_PCI_QUIRK(0x1043, 0x1740, "ASUS UX430UA", ALC295_FIXUP_ASUS_DACS),
    94089483        SND_PCI_QUIRK(0x1043, 0x17d1, "ASUS UX431FL", ALC294_FIXUP_ASUS_DUAL_SPK),
     9484        SND_PCI_QUIRK(0x1043, 0x1662, "ASUS GV301QH", ALC294_FIXUP_ASUS_DUAL_SPK),
    94099485        SND_PCI_QUIRK(0x1043, 0x1881, "ASUS Zephyrus S/M", ALC294_FIXUP_ASUS_GX502_PINS),
    94109486        SND_PCI_QUIRK(0x1043, 0x18b1, "Asus MJ401TA", ALC256_FIXUP_ASUS_HEADSET_MIC),
     
    94639539        SND_PCI_QUIRK(0x152d, 0x1082, "Quanta NL3", ALC269_FIXUP_LIFEBOOK),
    94649540        SND_PCI_QUIRK(0x1558, 0x1323, "Clevo N130ZU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
    9465         SND_PCI_QUIRK(0x1558, 0x1325, "System76 Darter Pro (darp5)", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
     9541        SND_PCI_QUIRK(0x1558, 0x1325, "Clevo N15[01][CW]U", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
    94669542        SND_PCI_QUIRK(0x1558, 0x1401, "Clevo L140[CZ]U", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
    94679543        SND_PCI_QUIRK(0x1558, 0x1403, "Clevo N140CU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
     
    94989574        SND_PCI_QUIRK(0x1558, 0x8535, "Clevo NH50D[BE]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
    94999575        SND_PCI_QUIRK(0x1558, 0x8536, "Clevo NH79D[BE]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
    9500         SND_PCI_QUIRK(0x1558, 0x8550, "System76 Gazelle (gaze14)", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
    9501         SND_PCI_QUIRK(0x1558, 0x8551, "System76 Gazelle (gaze14)", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
    9502         SND_PCI_QUIRK(0x1558, 0x8560, "System76 Gazelle (gaze14)", ALC269_FIXUP_HEADSET_MIC),
    9503         SND_PCI_QUIRK(0x1558, 0x8561, "System76 Gazelle (gaze14)", ALC269_FIXUP_HEADSET_MIC),
    9504         SND_PCI_QUIRK(0x1558, 0x8562, "Clevo NH[5|7][0-9]RZ[Q]", ALC269_FIXUP_DMIC),
     9576        SND_PCI_QUIRK(0x1558, 0x8550, "Clevo NH[57][0-9][ER][ACDH]Q", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
     9577        SND_PCI_QUIRK(0x1558, 0x8551, "Clevo NH[57][0-9][ER][ACDH]Q", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
     9578        SND_PCI_QUIRK(0x1558, 0x8560, "Clevo NH[57][0-9][ER][ACDH]Q", ALC269_FIXUP_HEADSET_MIC),
     9579        SND_PCI_QUIRK(0x1558, 0x8561, "Clevo NH[57][0-9][ER][ACDH]Q", ALC269_FIXUP_HEADSET_MIC),
     9580        SND_PCI_QUIRK(0x1558, 0x8562, "Clevo NH[57][0-9]RZ[Q]", ALC269_FIXUP_DMIC),
    95059581        SND_PCI_QUIRK(0x1558, 0x8668, "Clevo NP50B[BE]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
    95069582        SND_PCI_QUIRK(0x1558, 0x8680, "Clevo NJ50LU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
     
    95139589        SND_PCI_QUIRK(0x1558, 0x961d, "Clevo N960S[CDF]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
    95149590        SND_PCI_QUIRK(0x1558, 0x971d, "Clevo N970T[CDF]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
    9515         SND_PCI_QUIRK(0x1558, 0xa500, "Clevo NL53RU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
    9516         SND_PCI_QUIRK(0x1558, 0xa600, "Clevo NL5XNU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
     9591        SND_PCI_QUIRK(0x1558, 0xa500, "Clevo NL5[03]RU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
     9592        SND_PCI_QUIRK(0x1558, 0xa600, "Clevo NL50NU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
    95179593        SND_PCI_QUIRK(0x1558, 0xb018, "Clevo NP50D[BE]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
    95189594        SND_PCI_QUIRK(0x1558, 0xb019, "Clevo NH77D[BE]Q", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
     
    1040110477        case 0x10ec0245:
    1040210478        case 0x10ec0285:
    10403         case 0x10ec0287:
    1040410479        case 0x10ec0289:
    1040510480                spec->codec_variant = ALC269_TYPE_ALC215;
     
    1041510490                spec->init_hook = alc225_init;
    1041610491                spec->gen.mixer_nid = 0; /* no loopback on ALC225, ALC295 and ALC299 */
     10492                break;
     10493        case 0x10ec0287:
     10494                spec->codec_variant = ALC269_TYPE_ALC287;
     10495                spec->shutup = alc225_shutup;
     10496                spec->init_hook = alc225_init;
     10497                spec->gen.mixer_nid = 0; /* no loopback on ALC287 */
    1041710498                break;
    1041810499        case 0x10ec0234:
     
    1045210533        snd_hda_pick_fixup(codec, alc269_fixup_models,
    1045310534                       alc269_fixup_tbl, alc269_fixups);
     10535        /* FIXME: both TX300 and ROG Strix G17 have the same SSID, and
     10536         * the quirk breaks the latter (bko#214101).
     10537         * Clear the wrong entry.
     10538         */
     10539        if (codec->fixup_id == ALC282_FIXUP_ASUS_TX300 &&
     10540            codec->core.vendor_id == 0x10ec0294) {
     10541                codec_dbg(codec, "Clear wrong fixup for ASUS ROG Strix G17\n");
     10542                codec->fixup_id = HDA_FIXUP_ID_NOT_SET;
     10543        }
     10544
    1045410545        snd_hda_pick_pin_fixup(codec, alc269_pin_fixup_tbl, alc269_fixups, true);
    1045510546        snd_hda_pick_pin_fixup(codec, alc269_fallback_pin_fixup_tbl, alc269_fixups, false);
  • GPL/trunk/alsa-kernel/pci/hda/patch_via.c

    r679 r703  
    10631063
    10641064static const struct snd_pci_quirk vt2002p_fixups[] = {
     1065        SND_PCI_QUIRK(0x1043, 0x13f7, "Asus B23E", VIA_FIXUP_POWER_SAVE),
    10651066        SND_PCI_QUIRK(0x1043, 0x1487, "Asus G75", VIA_FIXUP_ASUS_G75),
    10661067        SND_PCI_QUIRK(0x1043, 0x8532, "Asus X202E", VIA_FIXUP_INTMIC_BOOST),
  • GPL/trunk/alsa-kernel/pci/intel8x0.c

    r695 r703  
    8383        ICH_REG_##name##_PIV    = base + 0x0a,  /* byte - prefetched index value */ \
    8484        ICH_REG_##name##_CR     = base + 0x0b,  /* byte - control register */ \
    85 };
     85}
    8686
    8787/* busmaster blocks */
     
    542542        } else {
    543543                res = iagetword(chip, reg + ac97->num * 0x80);
    544                 if ((tmp = igetdword(chip, ICHREG(GLOB_STA))) & ICH_RCS) {
     544                tmp = igetdword(chip, ICHREG(GLOB_STA));
     545                if (tmp & ICH_RCS) {
    545546                        /* reset RCS and preserve other R/WC bits */
    546547                        iputdword(chip, ICHREG(GLOB_STA), tmp &
     
    563564        if (snd_intel8x0_codec_semaphore(chip, codec) >= 0) {
    564565                iagetword(chip, codec * 0x80);
    565                 if ((tmp = igetdword(chip, ICHREG(GLOB_STA))) & ICH_RCS) {
     566                tmp = igetdword(chip, ICHREG(GLOB_STA));
     567                if (tmp & ICH_RCS) {
    566568                        /* reset RCS and preserve other R/WC bits */
    567569                        iputdword(chip, ICHREG(GLOB_STA), tmp &
     
    11091111                runtime->hw.period_bytes_max = 64*1024;
    11101112        }
    1111         if ((err = snd_pcm_hw_constraint_integer(runtime, SNDRV_PCM_HW_PARAM_PERIODS)) < 0)
     1113        err = snd_pcm_hw_constraint_integer(runtime, SNDRV_PCM_HW_PARAM_PERIODS);
     1114        if (err < 0)
    11121115                return err;
    11131116        runtime->private_data = ichdev;
     
    21942197                }
    21952198        }
    2196         if ((err = snd_ac97_bus(chip->card, 0, ops, chip, &pbus)) < 0)
     2199        err = snd_ac97_bus(chip->card, 0, ops, chip, &pbus);
     2200        if (err < 0)
    21972201                goto __err;
    21982202        pbus->private_free = snd_intel8x0_mixer_free_ac97_bus;
     
    22102214        for (i = 0; i < codecs; i++) {
    22112215                ac97.num = i;
    2212                 if ((err = snd_ac97_mixer(pbus, &ac97, &chip->ac97[i])) < 0) {
     2216                err = snd_ac97_mixer(pbus, &ac97, &chip->ac97[i]);
     2217                if (err < 0) {
    22132218                        if (err != -EACCES)
    22142219                                dev_err(chip->card->dev,
     
    24972502       
    24982503        if (chip->device_type != DEVICE_ALI) {
    2499                 if ((err = snd_intel8x0_ich_chip_init(chip, probing)) < 0)
     2504                err = snd_intel8x0_ich_chip_init(chip, probing);
     2505                if (err < 0)
    25002506                        return err;
    25012507                iagetword(chip, 0);     /* clear semaphore flag */
    25022508        } else {
    2503                 if ((err = snd_intel8x0_ali_chip_init(chip, probing)) < 0)
     2509                err = snd_intel8x0_ali_chip_init(chip, probing);
     2510                if (err < 0)
    25042511                        return err;
    25052512        }
     
    29432950        *r_intel8x0 = NULL;
    29442951
    2945         if ((err = pci_enable_device(pci)) < 0)
     2952        err = pci_enable_device(pci);
     2953        if (err < 0)
    29462954                return err;
    29472955
     
    29752983                chip->fix_nocache = 1; /* enable workaround */
    29762984
    2977         if ((err = pci_request_regions(pci, card->shortname)) < 0) {
     2985        err = pci_request_regions(pci, card->shortname);
     2986        if (err < 0) {
    29782987                kfree(chip);
    29792988                pci_disable_device(pci);
     
    30893098                chip->codec_isr_bits |= chip->codec_bit[i];
    30903099
    3091         if ((err = snd_intel8x0_chip_init(chip, 1)) < 0) {
     3100        err = snd_intel8x0_chip_init(chip, 1);
     3101        if (err < 0) {
    30923102                snd_intel8x0_free(chip);
    30933103                return err;
     
    31043114        card->sync_irq = chip->irq;
    31053115
    3106         if ((err = snd_device_new(card, SNDRV_DEV_LOWLEVEL, chip, &ops)) < 0) {
     3116        err = snd_device_new(card, SNDRV_DEV_LOWLEVEL, chip, &ops);
     3117        if (err < 0) {
    31073118                snd_intel8x0_free(chip);
    31083119                return err;
     
    32113222        }
    32123223
    3213         if ((err = snd_intel8x0_create(card, pci, pci_id->driver_data,
    3214                                        &chip)) < 0) {
     3224        err = snd_intel8x0_create(card, pci, pci_id->driver_data, &chip);
     3225        if (err < 0) {
    32153226                snd_card_free(card);
    32163227                return err;
     
    32183229        card->private_data = chip;
    32193230
    3220         if ((err = snd_intel8x0_mixer(chip, ac97_clock, ac97_quirk)) < 0) {
     3231        err = snd_intel8x0_mixer(chip, ac97_clock, ac97_quirk);
     3232        if (err < 0) {
    32213233                snd_card_free(card);
    32223234                return err;
    32233235        }
    3224         if ((err = snd_intel8x0_pcm(chip)) < 0) {
     3236        err = snd_intel8x0_pcm(chip);
     3237        if (err < 0) {
    32253238                snd_card_free(card);
    32263239                return err;
     
    32423255        }
    32433256
    3244         if ((err = snd_card_register(card)) < 0) {
     3257        err = snd_card_register(card);
     3258        if (err < 0) {
    32453259                snd_card_free(card);
    32463260                return err;
  • GPL/trunk/alsa-kernel/pci/intel8x0m.c

    r695 r703  
    5858        ICH_REG_##name##_PIV    = base + 0x0a,  /* byte - prefetched index value */ \
    5959        ICH_REG_##name##_CR     = base + 0x0b,  /* byte - control register */ \
    60 };
     60}
    6161
    6262/* busmaster blocks */
     
    343343        } else {
    344344                res = iagetword(chip, reg + ac97->num * 0x80);
    345                 if ((tmp = igetdword(chip, ICHREG(GLOB_STA))) & ICH_RCS) {
     345                tmp = igetdword(chip, ICHREG(GLOB_STA));
     346                if (tmp & ICH_RCS) {
    346347                        /* reset RCS and preserve other R/WC bits */
    347348                        iputdword(chip, ICHREG(GLOB_STA),
     
    801802        glob_sta = igetdword(chip, ICHREG(GLOB_STA));
    802803
    803         if ((err = snd_ac97_bus(chip->card, 0, &ops, chip, &pbus)) < 0)
     804        err = snd_ac97_bus(chip->card, 0, &ops, chip, &pbus);
     805        if (err < 0)
    804806                goto __err;
    805807        pbus->private_free = snd_intel8x0m_mixer_free_ac97_bus;
     
    810812        ac97.pci = chip->pci;
    811813        ac97.num = glob_sta & ICH_SCR ? 1 : 0;
    812         if ((err = snd_ac97_mixer(pbus, &ac97, &x97)) < 0) {
     814        err = snd_ac97_mixer(pbus, &ac97, &x97);
     815        if (err < 0) {
    813816                dev_err(chip->card->dev,
    814817                        "Unable to initialize codec #%d\n", ac97.num);
     
    928931        int err;
    929932       
    930         if ((err = snd_intel8x0m_ich_chip_init(chip, probing)) < 0)
     933        err = snd_intel8x0m_ich_chip_init(chip, probing);
     934        if (err < 0)
    931935                return err;
    932936        iagetword(chip, 0);     /* clear semaphore flag */
     
    10761080        *r_intel8x0m = NULL;
    10771081
    1078         if ((err = pci_enable_device(pci)) < 0)
     1082        err = pci_enable_device(pci);
     1083        if (err < 0)
    10791084                return err;
    10801085
     
    10901095        chip->irq = -1;
    10911096
    1092         if ((err = pci_request_regions(pci, card->shortname)) < 0) {
     1097        err = pci_request_regions(pci, card->shortname);
     1098        if (err < 0) {
    10931099                kfree(chip);
    10941100                pci_disable_device(pci);
     
    11681174        pci_set_master(pci);
    11691175
    1170         if ((err = snd_intel8x0m_chip_init(chip, 1)) < 0) {
     1176        err = snd_intel8x0m_chip_init(chip, 1);
     1177        if (err < 0) {
    11711178                snd_intel8x0m_free(chip);
    11721179                return err;
     
    11821189        card->sync_irq = chip->irq;
    11831190
    1184         if ((err = snd_device_new(card, SNDRV_DEV_LOWLEVEL, chip, &ops)) < 0) {
     1191        err = snd_device_new(card, SNDRV_DEV_LOWLEVEL, chip, &ops);
     1192        if (err < 0) {
    11851193                snd_intel8x0m_free(chip);
    11861194                return err;
     
    12391247        strcat(card->shortname," Modem");
    12401248
    1241         if ((err = snd_intel8x0m_create(card, pci, pci_id->driver_data, &chip)) < 0) {
     1249        err = snd_intel8x0m_create(card, pci, pci_id->driver_data, &chip);
     1250        if (err < 0) {
    12421251                snd_card_free(card);
    12431252                return err;
     
    12451254        card->private_data = chip;
    12461255
    1247         if ((err = snd_intel8x0m_mixer(chip, ac97_clock)) < 0) {
     1256        err = snd_intel8x0m_mixer(chip, ac97_clock);
     1257        if (err < 0) {
    12481258                snd_card_free(card);
    12491259                return err;
    12501260        }
    1251         if ((err = snd_intel8x0m_pcm(chip)) < 0) {
     1261        err = snd_intel8x0m_pcm(chip);
     1262        if (err < 0) {
    12521263                snd_card_free(card);
    12531264                return err;
     
    12591270                card->shortname, chip->irq);
    12601271
    1261         if ((err = snd_card_register(card)) < 0) {
     1272        err = snd_card_register(card);
     1273        if (err < 0) {
    12621274                snd_card_free(card);
    12631275                return err;
  • GPL/trunk/alsa-kernel/pci/korg1212/korg1212.c

    r695 r703  
    15281528        }
    15291529
    1530         if ((err = snd_korg1212_SetRate(korg1212, params_rate(params))) < 0) {
     1530        err = snd_korg1212_SetRate(korg1212, params_rate(params));
     1531        if (err < 0) {
    15311532                spin_unlock_irqrestore(&korg1212->lock, flags);
    15321533                return err;
     
    21602161
    21612162        * rchip = NULL;
    2162         if ((err = pci_enable_device(pci)) < 0)
     2163        err = pci_enable_device(pci);
     2164        if (err < 0)
    21632165                return err;
    21642166
     
    21972199                korg1212->volumePhase[i] = 0;
    21982200
    2199         if ((err = pci_request_regions(pci, "korg1212")) < 0) {
     2201        err = pci_request_regions(pci, "korg1212");
     2202        if (err < 0) {
    22002203                kfree(korg1212);
    22012204                pci_disable_device(pci);
     
    22212224                   stateName[korg1212->cardState]);
    22222225
    2223         if ((korg1212->iobase = ioremap(korg1212->iomem, iomem_size)) == NULL) {
     2226        korg1212->iobase = ioremap(korg1212->iomem, iomem_size);
     2227        if (!korg1212->iobase) {
    22242228                snd_printk(KERN_ERR "korg1212: unable to remap memory region 0x%lx-0x%lx\n", korg1212->iomem,
    22252229                           korg1212->iomem + iomem_size - 1);
     
    23612365                K1212_DEBUG_PRINTK("K1212_DEBUG: Reboot Card - RC = %d [%s]\n", rc, stateName[korg1212->cardState]);
    23622366
    2363         if ((err = snd_device_new(card, SNDRV_DEV_LOWLEVEL, korg1212, &ops)) < 0) {
     2367        err = snd_device_new(card, SNDRV_DEV_LOWLEVEL, korg1212, &ops);
     2368        if (err < 0) {
    23642369                snd_korg1212_free(korg1212);
    23652370                return err;
     
    23862391               korg1212->AdatTimeCodePhy, LowerWordSwap(korg1212->AdatTimeCodePhy));
    23872392
    2388         if ((err = snd_pcm_new(korg1212->card, "korg1212", 0, 1, 1, &korg1212->pcm)) < 0)
     2393        err = snd_pcm_new(korg1212->card, "korg1212", 0, 1, 1, &korg1212->pcm);
     2394        if (err < 0)
    23892395                return err;
    23902396
     
    24372443                return err;
    24382444
    2439         if ((err = snd_korg1212_create(card, pci, &korg1212)) < 0) {
     2445        err = snd_korg1212_create(card, pci, &korg1212);
     2446        if (err < 0) {
    24402447                snd_card_free(card);
    24412448                return err;
     
    24492456        K1212_DEBUG_PRINTK("K1212_DEBUG: %s\n", card->longname);
    24502457
    2451         if ((err = snd_card_register(card)) < 0) {
     2458        err = snd_card_register(card);
     2459        if (err < 0) {
    24522460                snd_card_free(card);
    24532461                return err;
  • GPL/trunk/alsa-kernel/pci/maestro3.c

    r695 r703  
    17771777        int err;
    17781778
    1779         if ((err = snd_m3_substream_open(chip, subs)) < 0)
     1779        err = snd_m3_substream_open(chip, subs);
     1780        if (err < 0)
    17801781                return err;
    17811782
     
    18011802        int err;
    18021803
    1803         if ((err = snd_m3_substream_open(chip, subs)) < 0)
     1804        err = snd_m3_substream_open(chip, subs);
     1805        if (err < 0)
    18041806                return err;
    18051807
     
    20482050        };
    20492051
    2050         if ((err = snd_ac97_bus(chip->card, 0, &ops, NULL, &pbus)) < 0)
     2052        err = snd_ac97_bus(chip->card, 0, &ops, NULL, &pbus);
     2053        if (err < 0)
    20512054                return err;
    20522055       
    20532056        memset(&ac97, 0, sizeof(ac97));
    20542057        ac97.private_data = chip;
    2055         if ((err = snd_ac97_mixer(pbus, &ac97, &chip->ac97)) < 0)
     2058        err = snd_ac97_mixer(pbus, &ac97, &chip->ac97);
     2059        if (err < 0)
    20562060                return err;
    20572061
     
    26542658                goto free_chip;
    26552659
    2656         if ((err = snd_m3_mixer(chip)) < 0)
     2660        err = snd_m3_mixer(chip);
     2661        if (err < 0)
    26572662                return err;
    26582663
    26592664        for (i = 0; i < chip->num_substreams; i++) {
    26602665                struct m3_dma *s = &chip->substreams[i];
    2661                 if ((err = snd_m3_assp_client_init(chip, s, i)) < 0)
     2666                err = snd_m3_assp_client_init(chip, s, i);
     2667                if (err < 0)
    26622668                        return err;
    26632669        }
    26642670
    2665         if ((err = snd_m3_pcm(chip, 0)) < 0)
     2671        err = snd_m3_pcm(chip, 0);
     2672        if (err < 0)
    26662673                return err;
    26672674
  • GPL/trunk/alsa-kernel/pci/nm256/nm256.c

    r695 r703  
    13231323                return -ENOMEM;
    13241324
    1325         if ((err = snd_ac97_bus(chip->card, 0, &ops, NULL, &pbus)) < 0)
     1325        err = snd_ac97_bus(chip->card, 0, &ops, NULL, &pbus);
     1326        if (err < 0)
    13261327                return err;
    13271328
     
    14811482        *chip_ret = NULL;
    14821483
    1483         if ((err = pci_enable_device(pci)) < 0)
     1484        err = pci_enable_device(pci);
     1485        if (err < 0)
    14841486                return err;
    14851487
     
    15731575        else {
    15741576                /* get buffer end pointer from signature */
    1575                 if ((err = snd_nm256_peek_for_sig(chip)) < 0)
     1577                err = snd_nm256_peek_for_sig(chip);
     1578                if (err < 0)
    15761579                        goto __error;
    15771580        }
     
    16231626        // pci_set_master(pci); /* needed? */
    16241627       
    1625         if ((err = snd_device_new(card, SNDRV_DEV_LOWLEVEL, chip, &ops)) < 0)
     1628        err = snd_device_new(card, SNDRV_DEV_LOWLEVEL, chip, &ops);
     1629        if (err < 0)
    16261630                goto __error;
    16271631
     
    17051709        if (capture_bufsize > 128)
    17061710                capture_bufsize = 128;
    1707         if ((err = snd_nm256_create(card, pci, &chip)) < 0) {
     1711        err = snd_nm256_create(card, pci, &chip);
     1712        if (err < 0) {
    17081713                snd_card_free(card);
    17091714                return err;
     
    17211726        }
    17221727
    1723         if ((err = snd_nm256_pcm(chip, 0)) < 0 ||
    1724             (err = snd_nm256_mixer(chip)) < 0) {
     1728        err = snd_nm256_pcm(chip, 0);
     1729        if (err < 0) {
     1730                snd_card_free(card);
     1731                return err;
     1732        }
     1733        err = snd_nm256_mixer(chip);
     1734        if (err < 0) {
    17251735                snd_card_free(card);
    17261736                return err;
     
    17321742                chip->buffer_addr, chip->cport_addr, chip->irq);
    17331743
    1734         if ((err = snd_card_register(card)) < 0) {
     1744        err = snd_card_register(card);
     1745        if (err < 0) {
    17351746                snd_card_free(card);
    17361747                return err;
  • GPL/trunk/alsa-kernel/pci/rme32.c

    r695 r703  
    669669
    670670        spin_lock_irq(&rme32->lock);
    671         if ((rme32->rcreg & RME32_RCR_KMODE) &&
    672             (rate = snd_rme32_capture_getrate(rme32, &dummy)) > 0) {
     671        rate = 0;
     672        if (rme32->rcreg & RME32_RCR_KMODE)
     673                rate = snd_rme32_capture_getrate(rme32, &dummy);
     674        if (rate > 0) {
    673675                /* AutoSync */
    674676                if ((int)params_rate(params) != rate) {
     
    676678                        return -EIO;
    677679                }
    678         } else if ((err = snd_rme32_playback_setrate(rme32, params_rate(params))) < 0) {
    679                 spin_unlock_irq(&rme32->lock);
    680                 return err;
    681         }
    682         if ((err = snd_rme32_setformat(rme32, params_format(params))) < 0) {
     680        } else {
     681                err = snd_rme32_playback_setrate(rme32, params_rate(params));
     682                if (err < 0) {
     683                        spin_unlock_irq(&rme32->lock);
     684                        return err;
     685                }
     686        }
     687        err = snd_rme32_setformat(rme32, params_format(params));
     688        if (err < 0) {
    683689                spin_unlock_irq(&rme32->lock);
    684690                return err;
     
    724730        writel(rme32->wcreg, rme32->iobase + RME32_IO_CONTROL_REGISTER);
    725731
    726         if ((err = snd_rme32_setformat(rme32, params_format(params))) < 0) {
     732        err = snd_rme32_setformat(rme32, params_format(params));
     733        if (err < 0) {
    727734                spin_unlock_irq(&rme32->lock);
    728735                return err;
    729736        }
    730         if ((err = snd_rme32_playback_setrate(rme32, params_rate(params))) < 0) {
     737        err = snd_rme32_playback_setrate(rme32, params_rate(params));
     738        if (err < 0) {
    731739                spin_unlock_irq(&rme32->lock);
    732740                return err;
    733741        }
    734         if ((rate = snd_rme32_capture_getrate(rme32, &isadat)) > 0) {
     742        rate = snd_rme32_capture_getrate(rme32, &isadat);
     743        if (rate > 0) {
    735744                if ((int)params_rate(params) != rate) {
    736745                        spin_unlock_irq(&rme32->lock);
     
    855864                runtime->hw.rate_max = 96000;
    856865        }
    857         if ((rme32->rcreg & RME32_RCR_KMODE) &&
    858             (rate = snd_rme32_capture_getrate(rme32, &dummy)) > 0) {
     866        rate = 0;
     867        if (rme32->rcreg & RME32_RCR_KMODE)
     868                rate = snd_rme32_capture_getrate(rme32, &dummy);
     869        if (rate > 0) {
    859870                /* AutoSync */
    860871                runtime->hw.rates = snd_pcm_rate_to_rate_bit(rate);
     
    896907                runtime->hw.rate_max = 96000;
    897908        }
    898         if ((rate = snd_rme32_capture_getrate(rme32, &isadat)) > 0) {
     909        rate = snd_rme32_capture_getrate(rme32, &isadat);
     910        if (rate > 0) {
    899911                if (isadat) {
    900912                        return -EIO;
     
    933945        else
    934946                runtime->hw = snd_rme32_adat_info;
    935         if ((rme32->rcreg & RME32_RCR_KMODE) &&
    936             (rate = snd_rme32_capture_getrate(rme32, &dummy)) > 0) {
     947        rate = 0;
     948        if (rme32->rcreg & RME32_RCR_KMODE)
     949                rate = snd_rme32_capture_getrate(rme32, &dummy);
     950        if (rate > 0) {
    937951                /* AutoSync */
    938952                runtime->hw.rates = snd_pcm_rate_to_rate_bit(rate);
     
    956970        else
    957971                runtime->hw = snd_rme32_adat_info;
    958         if ((rate = snd_rme32_capture_getrate(rme32, &isadat)) > 0) {
     972        rate = snd_rme32_capture_getrate(rme32, &isadat);
     973        if (rate > 0) {
    959974                if (!isadat) {
    960975                        return -EIO;
     
    13081323        spin_lock_init(&rme32->lock);
    13091324
    1310         if ((err = pci_enable_device(pci)) < 0)
     1325        err = pci_enable_device(pci);
     1326        if (err < 0)
    13111327                return err;
    13121328
    1313         if ((err = pci_request_regions(pci, "RME32")) < 0)
     1329        err = pci_request_regions(pci, "RME32");
     1330        if (err < 0)
    13141331                return err;
    13151332        rme32->port = pci_resource_start(rme32->pci, 0);
     
    13351352
    13361353        /* set up ALSA pcm device for S/PDIF */
    1337         if ((err = snd_pcm_new(rme32->card, "Digi32 IEC958", 0, 1, 1, &rme32->spdif_pcm)) < 0) {
     1354        err = snd_pcm_new(rme32->card, "Digi32 IEC958", 0, 1, 1, &rme32->spdif_pcm);
     1355        if (err < 0)
    13381356                return err;
    1339         }
    13401357        rme32->spdif_pcm->private_data = rme32;
    13411358        rme32->spdif_pcm->private_free = snd_rme32_free_spdif_pcm;
     
    13641381        }
    13651382        else {
    1366                 if ((err = snd_pcm_new(rme32->card, "Digi32 ADAT", 1,
    1367                                        1, 1, &rme32->adat_pcm)) < 0)
    1368                 {
     1383                err = snd_pcm_new(rme32->card, "Digi32 ADAT", 1,
     1384                                  1, 1, &rme32->adat_pcm);
     1385                if (err < 0)
    13691386                        return err;
    1370                 }               
    13711387                rme32->adat_pcm->private_data = rme32;
    13721388                rme32->adat_pcm->private_free = snd_rme32_free_adat_pcm;
     
    14111427
    14121428        /* init switch interface */
    1413         if ((err = snd_rme32_create_switches(rme32->card, rme32)) < 0) {
     1429        err = snd_rme32_create_switches(rme32->card, rme32);
     1430        if (err < 0)
    14141431                return err;
    1415         }
    14161432
    14171433        /* init proc interface */
     
    18561872
    18571873        for (idx = 0; idx < (int)ARRAY_SIZE(snd_rme32_controls); idx++) {
    1858                 if ((err = snd_ctl_add(card, kctl = snd_ctl_new1(&snd_rme32_controls[idx], rme32))) < 0)
     1874                kctl = snd_ctl_new1(&snd_rme32_controls[idx], rme32);
     1875                err = snd_ctl_add(card, kctl);
     1876                if (err < 0)
    18591877                        return err;
    18601878                if (idx == 1)   /* IEC958 (S/PDIF) Stream */
     
    19001918        if (fullduplex[dev])
    19011919                rme32->fullduplex_mode = 1;
    1902         if ((err = snd_rme32_create(rme32)) < 0) {
     1920        err = snd_rme32_create(rme32);
     1921        if (err < 0) {
    19031922                snd_card_free(card);
    19041923                return err;
     
    19201939                card->shortname, rme32->rev, rme32->port, rme32->irq);
    19211940
    1922         if ((err = snd_card_register(card)) < 0) {
     1941        err = snd_card_register(card);
     1942        if (err < 0) {
    19231943                snd_card_free(card);
    19241944                return err;
  • GPL/trunk/alsa-kernel/pci/rme96.c

    r695 r703  
    667667
    668668        if (!(rme96->wcreg & RME96_WCR_MASTER) &&
    669             snd_rme96_getinputtype(rme96) != RME96_INPUT_ANALOG &&
    670             (rate = snd_rme96_capture_getrate(rme96, &dummy)) > 0)
    671         {
    672                 /* slave clock */
    673                 return rate;
    674         }
     669            snd_rme96_getinputtype(rme96) != RME96_INPUT_ANALOG) {
     670                rate = snd_rme96_capture_getrate(rme96, &dummy);
     671                if (rate > 0) {
     672                        /* slave clock */
     673                        return rate;
     674                }
     675        }
     676
    675677        rate = ((rme96->wcreg >> RME96_WCR_BITPOS_FREQ_0) & 1) +
    676678                (((rme96->wcreg >> RME96_WCR_BITPOS_FREQ_1) & 1) << 1);
     
    985987
    986988        spin_lock_irq(&rme96->lock);
     989        rate = 0;
    987990        if (!(rme96->wcreg & RME96_WCR_MASTER) &&
    988             snd_rme96_getinputtype(rme96) != RME96_INPUT_ANALOG &&
    989             (rate = snd_rme96_capture_getrate(rme96, &dummy)) > 0)
    990         {
     991            snd_rme96_getinputtype(rme96) != RME96_INPUT_ANALOG)
     992                rate = snd_rme96_capture_getrate(rme96, &dummy);
     993        if (rate > 0) {
    991994                /* slave clock */
    992995                if ((int)params_rate(params) != rate) {
     
    10471050
    10481051        spin_lock_irq(&rme96->lock);
    1049         if ((err = snd_rme96_capture_setformat(rme96, params_format(params))) < 0) {
     1052        err = snd_rme96_capture_setformat(rme96, params_format(params));
     1053        if (err < 0) {
    10501054                spin_unlock_irq(&rme96->lock);
    10511055                return err;
    10521056        }
    10531057        if (snd_rme96_getinputtype(rme96) == RME96_INPUT_ANALOG) {
    1054                 if ((err = snd_rme96_capture_analog_setrate(rme96,
    1055                                                             params_rate(params))) < 0)
    1056                 {
     1058                err = snd_rme96_capture_analog_setrate(rme96, params_rate(params));
     1059                if (err < 0) {
    10571060                        spin_unlock_irq(&rme96->lock);
    10581061                        return err;
    10591062                }
    1060         } else if ((rate = snd_rme96_capture_getrate(rme96, &isadat)) > 0) {
    1061                 if ((int)params_rate(params) != rate) {
    1062                         spin_unlock_irq(&rme96->lock);
    1063                         return -EIO;                   
    1064                 }
    1065                 if ((isadat && runtime->hw.channels_min == 2) ||
    1066                     (!isadat && runtime->hw.channels_min == 8))
    1067                 {
    1068                         spin_unlock_irq(&rme96->lock);
    1069                         return -EIO;
    1070                 }
     1063        } else {
     1064                rate = snd_rme96_capture_getrate(rme96, &isadat);
     1065                if (rate > 0) {
     1066                        if ((int)params_rate(params) != rate) {
     1067                                spin_unlock_irq(&rme96->lock);
     1068                                return -EIO;
     1069                        }
     1070                        if ((isadat && runtime->hw.channels_min == 2) ||
     1071                            (!isadat && runtime->hw.channels_min == 8)) {
     1072                                spin_unlock_irq(&rme96->lock);
     1073                                return -EIO;
     1074                        }
     1075                }
    10711076        }
    10721077        snd_rme96_setframelog(rme96, params_channels(params), 0);
     
    11611166        snd_pcm_hw_constraint_single(runtime, SNDRV_PCM_HW_PARAM_BUFFER_BYTES,
    11621167                                     RME96_BUFFER_SIZE);
    1163         if ((size = rme96->playback_periodsize) != 0 ||
    1164             (size = rme96->capture_periodsize) != 0)
     1168        size = rme96->playback_periodsize;
     1169        if (!size)
     1170                size = rme96->capture_periodsize;
     1171        if (size)
    11651172                snd_pcm_hw_constraint_single(runtime,
    11661173                                             SNDRV_PCM_HW_PARAM_PERIOD_BYTES,
     
    11921199        runtime->hw = snd_rme96_playback_spdif_info;
    11931200        if (!(rme96->wcreg & RME96_WCR_MASTER) &&
    1194             snd_rme96_getinputtype(rme96) != RME96_INPUT_ANALOG &&
    1195             (rate = snd_rme96_capture_getrate(rme96, &dummy)) > 0)
    1196         {
    1197                 /* slave clock */
    1198                 runtime->hw.rates = snd_pcm_rate_to_rate_bit(rate);
    1199                 runtime->hw.rate_min = rate;
    1200                 runtime->hw.rate_max = rate;
     1201            snd_rme96_getinputtype(rme96) != RME96_INPUT_ANALOG) {
     1202                rate = snd_rme96_capture_getrate(rme96, &dummy);
     1203                if (rate > 0) {
     1204                        /* slave clock */
     1205                        runtime->hw.rates = snd_pcm_rate_to_rate_bit(rate);
     1206                        runtime->hw.rate_min = rate;
     1207                        runtime->hw.rate_max = rate;
     1208                }
    12011209        }       
    12021210        rme96_set_buffer_size_constraint(rme96, runtime);
     
    12181226        snd_pcm_set_sync(substream);
    12191227        runtime->hw = snd_rme96_capture_spdif_info;
    1220         if (snd_rme96_getinputtype(rme96) != RME96_INPUT_ANALOG &&
    1221             (rate = snd_rme96_capture_getrate(rme96, &isadat)) > 0)
    1222         {
    1223                 if (isadat) {
    1224                         return -EIO;
    1225                 }
    1226                 runtime->hw.rates = snd_pcm_rate_to_rate_bit(rate);
    1227                 runtime->hw.rate_min = rate;
    1228                 runtime->hw.rate_max = rate;
    1229         }
     1228        if (snd_rme96_getinputtype(rme96) != RME96_INPUT_ANALOG) {
     1229                rate = snd_rme96_capture_getrate(rme96, &isadat);
     1230                if (rate > 0) {
     1231                        if (isadat)
     1232                                return -EIO;
     1233                        runtime->hw.rates = snd_pcm_rate_to_rate_bit(rate);
     1234                        runtime->hw.rate_min = rate;
     1235                        runtime->hw.rate_max = rate;
     1236                }
     1237        }
    12301238       
    12311239        spin_lock_irq(&rme96->lock);
     
    12611269        runtime->hw = snd_rme96_playback_adat_info;
    12621270        if (!(rme96->wcreg & RME96_WCR_MASTER) &&
    1263             snd_rme96_getinputtype(rme96) != RME96_INPUT_ANALOG &&
    1264             (rate = snd_rme96_capture_getrate(rme96, &dummy)) > 0)
    1265         {
    1266                 /* slave clock */
    1267                 runtime->hw.rates = snd_pcm_rate_to_rate_bit(rate);
    1268                 runtime->hw.rate_min = rate;
    1269                 runtime->hw.rate_max = rate;
    1270         }       
     1271            snd_rme96_getinputtype(rme96) != RME96_INPUT_ANALOG) {
     1272                rate = snd_rme96_capture_getrate(rme96, &dummy);
     1273                if (rate > 0) {
     1274                        /* slave clock */
     1275                        runtime->hw.rates = snd_pcm_rate_to_rate_bit(rate);
     1276                        runtime->hw.rate_min = rate;
     1277                        runtime->hw.rate_max = rate;
     1278                }
     1279        }
     1280
    12711281        rme96_set_buffer_size_constraint(rme96, runtime);
    12721282        return 0;
     
    12871297                return -EIO;
    12881298        }
    1289         if ((rate = snd_rme96_capture_getrate(rme96, &isadat)) > 0) {
     1299        rate = snd_rme96_capture_getrate(rme96, &isadat);
     1300        if (rate > 0) {
    12901301                if (!isadat) {
    12911302                        return -EIO;
     
    16041615        spin_lock_init(&rme96->lock);
    16051616
    1606         if ((err = pci_enable_device(pci)) < 0)
     1617        err = pci_enable_device(pci);
     1618        if (err < 0)
    16071619                return err;
    16081620
    1609         if ((err = pci_request_regions(pci, "RME96")) < 0)
     1621        err = pci_request_regions(pci, "RME96");
     1622        if (err < 0)
    16101623                return err;
    16111624        rme96->port = pci_resource_start(rme96->pci, 0);
     
    16311644       
    16321645        /* set up ALSA pcm device for S/PDIF */
    1633         if ((err = snd_pcm_new(rme96->card, "Digi96 IEC958", 0,
    1634                                1, 1, &rme96->spdif_pcm)) < 0)
    1635         {
     1646        err = snd_pcm_new(rme96->card, "Digi96 IEC958", 0,
     1647                          1, 1, &rme96->spdif_pcm);
     1648        if (err < 0)
    16361649                return err;
    1637         }
     1650
    16381651        rme96->spdif_pcm->private_data = rme96;
    16391652        rme96->spdif_pcm->private_free = snd_rme96_free_spdif_pcm;
     
    16491662                rme96->adat_pcm = NULL;
    16501663        } else {
    1651                 if ((err = snd_pcm_new(rme96->card, "Digi96 ADAT", 1,
    1652                                        1, 1, &rme96->adat_pcm)) < 0)
    1653                 {
     1664                err = snd_pcm_new(rme96->card, "Digi96 ADAT", 1,
     1665                                  1, 1, &rme96->adat_pcm);
     1666                if (err < 0)
    16541667                        return err;
    1655                 }               
    16561668                rme96->adat_pcm->private_data = rme96;
    16571669                rme96->adat_pcm->private_free = snd_rme96_free_adat_pcm;
     
    17021714       
    17031715        /* init switch interface */
    1704         if ((err = snd_rme96_create_switches(rme96->card, rme96)) < 0) {
     1716        err = snd_rme96_create_switches(rme96->card, rme96);
     1717        if (err < 0)
    17051718                return err;
    1706         }
    17071719
    17081720        /* init proc interface */
     
    23372349
    23382350        for (idx = 0; idx < 7; idx++) {
    2339                 if ((err = snd_ctl_add(card, kctl = snd_ctl_new1(&snd_rme96_controls[idx], rme96))) < 0)
     2351                kctl = snd_ctl_new1(&snd_rme96_controls[idx], rme96);
     2352                err = snd_ctl_add(card, kctl);
     2353                if (err < 0)
    23402354                        return err;
    23412355                if (idx == 1)   /* IEC958 (S/PDIF) Stream */
     
    23442358
    23452359        if (RME96_HAS_ANALOG_OUT(rme96)) {
    2346                 for (idx = 7; idx < 10; idx++)
    2347                         if ((err = snd_ctl_add(card, snd_ctl_new1(&snd_rme96_controls[idx], rme96))) < 0)
     2360                for (idx = 7; idx < 10; idx++) {
     2361                        err = snd_ctl_add(card, snd_ctl_new1(&snd_rme96_controls[idx], rme96));
     2362                        if (err < 0)
    23482363                                return err;
     2364                }
    23492365        }
    23502366       
  • GPL/trunk/alsa-kernel/pci/rme9652/hdsp.c

    r695 r703  
    290290        return 110100480000000 / rate; // 105 MHz
    291291*/
    292 #define DDS_NUMERATOR 104857600000000ULL;  /*  =  2^20 * 10^8 */
     292#define DDS_NUMERATOR 104857600000000ULL  /*  =  2^20 * 10^8 */
    293293
    294294#define hdsp_encode_latency(x)       (((x)<<1) & HDSP_LatencyMask)
     
    13191319        if (hmidi->output) {
    13201320                if (!snd_rawmidi_transmit_empty (hmidi->output)) {
    1321                         if ((n_pending = snd_hdsp_midi_output_possible (hmidi->hdsp, hmidi->id)) > 0) {
     1321                        n_pending = snd_hdsp_midi_output_possible(hmidi->hdsp, hmidi->id);
     1322                        if (n_pending > 0) {
    13221323                                if (n_pending > (int)sizeof (buf))
    13231324                                        n_pending = sizeof (buf);
    13241325
    1325                                 if ((to_write = snd_rawmidi_transmit (hmidi->output, buf, n_pending)) > 0) {
     1326                                to_write = snd_rawmidi_transmit(hmidi->output, buf, n_pending);
     1327                                if (to_write > 0) {
    13261328                                        for (i = 0; i < to_write; ++i)
    13271329                                                snd_hdsp_midi_write_byte (hmidi->hdsp, hmidi->id, buf[i]);
     
    13421344
    13431345        spin_lock_irqsave (&hmidi->lock, flags);
    1344         if ((n_pending = snd_hdsp_midi_input_available (hmidi->hdsp, hmidi->id)) > 0) {
     1346        n_pending = snd_hdsp_midi_input_available(hmidi->hdsp, hmidi->id);
     1347        if (n_pending > 0) {
    13451348                if (hmidi->input) {
    13461349                        if (n_pending > (int)sizeof (buf))
     
    33233326
    33243327        for (idx = 0; idx < ARRAY_SIZE(snd_hdsp_controls); idx++) {
    3325                 if ((err = snd_ctl_add(card, kctl = snd_ctl_new1(&snd_hdsp_controls[idx], hdsp))) < 0)
     3328                kctl = snd_ctl_new1(&snd_hdsp_controls[idx], hdsp);
     3329                err = snd_ctl_add(card, kctl);
     3330                if (err < 0)
    33263331                        return err;
    33273332                if (idx == 1)   /* IEC958 (S/PDIF) Stream */
     
    33323337        snd_hdsp_adat_sync_check.name = "ADAT Lock Status";
    33333338        snd_hdsp_adat_sync_check.index = 1;
    3334         if ((err = snd_ctl_add (card, kctl = snd_ctl_new1(&snd_hdsp_adat_sync_check, hdsp))))
     3339        kctl = snd_ctl_new1(&snd_hdsp_adat_sync_check, hdsp);
     3340        err = snd_ctl_add(card, kctl);
     3341        if (err < 0)
    33353342                return err;
    33363343        if (hdsp->io_type == Digiface || hdsp->io_type == H9652) {
    33373344                for (idx = 1; idx < 3; ++idx) {
    33383345                        snd_hdsp_adat_sync_check.index = idx+1;
    3339                         if ((err = snd_ctl_add (card, kctl = snd_ctl_new1(&snd_hdsp_adat_sync_check, hdsp))))
     3346                        kctl = snd_ctl_new1(&snd_hdsp_adat_sync_check, hdsp);
     3347                        err = snd_ctl_add(card, kctl);
     3348                        if (err < 0)
    33403349                                return err;
    33413350                }
     
    33453354        if (hdsp->io_type == H9632) {
    33463355                for (idx = 0; idx < ARRAY_SIZE(snd_hdsp_9632_controls); idx++) {
    3347                         if ((err = snd_ctl_add(card, kctl = snd_ctl_new1(&snd_hdsp_9632_controls[idx], hdsp))) < 0)
     3356                        kctl = snd_ctl_new1(&snd_hdsp_9632_controls[idx], hdsp);
     3357                        err = snd_ctl_add(card, kctl);
     3358                        if (err < 0)
    33483359                                return err;
    33493360                }
     
    33633374        /* AEB control for H96xx card */
    33643375        if (hdsp->io_type == H9632 || hdsp->io_type == H9652) {
    3365                 if ((err = snd_ctl_add(card, kctl = snd_ctl_new1(&snd_hdsp_96xx_aeb, hdsp))) < 0)
    3366                                 return err;
     3376                kctl = snd_ctl_new1(&snd_hdsp_96xx_aeb, hdsp);
     3377                err = snd_ctl_add(card, kctl);
     3378                if (err < 0)
     3379                        return err;
    33673380        }
    33683381
     
    39433956                return NULL;
    39443957
    3945         if ((mapped_channel = hdsp->channel_map[channel]) < 0)
     3958        mapped_channel = hdsp->channel_map[channel];
     3959        if (mapped_channel < 0)
    39463960                return NULL;
    39473961
     
    41154129        spin_lock_irq(&hdsp->lock);
    41164130        if (! hdsp->clock_source_locked) {
    4117                 if ((err = hdsp_set_rate(hdsp, params_rate(params), 0)) < 0) {
     4131                err = hdsp_set_rate(hdsp, params_rate(params), 0);
     4132                if (err < 0) {
    41184133                        spin_unlock_irq(&hdsp->lock);
    41194134                        _snd_pcm_hw_param_setempty(params, SNDRV_PCM_HW_PARAM_RATE);
     
    41234138        spin_unlock_irq(&hdsp->lock);
    41244139
    4125         if ((err = hdsp_set_interrupt_interval(hdsp, params_period_size(params))) < 0) {
     4140        err = hdsp_set_interrupt_interval(hdsp, params_period_size(params));
     4141        if (err < 0) {
    41264142                _snd_pcm_hw_param_setempty(params, SNDRV_PCM_HW_PARAM_PERIOD_SIZE);
    41274143                return err;
     
    48554871                if (hdsp->io_type == H9652 || hdsp->io_type == H9632) return -EINVAL;
    48564872                if (hdsp->io_type == Undefined) {
    4857                         if ((err = hdsp_get_iobox_version(hdsp)) < 0)
     4873                        err = hdsp_get_iobox_version(hdsp);
     4874                        if (err < 0)
    48584875                                return err;
    48594876                }
     
    48614878                hdsp_version.io_type = hdsp->io_type;
    48624879                hdsp_version.firmware_rev = hdsp->firmware_rev;
    4863                 if ((err = copy_to_user(argp, &hdsp_version, sizeof(hdsp_version))))
    4864                         return -EFAULT;
     4880                if (copy_to_user(argp, &hdsp_version, sizeof(hdsp_version)))
     4881                        return -EFAULT;
    48654882                break;
    48664883        }
     
    49014918                hdsp->state |= HDSP_FirmwareCached;
    49024919
    4903                 if ((err = snd_hdsp_load_firmware_from_cache(hdsp)) < 0)
     4920                err = snd_hdsp_load_firmware_from_cache(hdsp);
     4921                if (err < 0)
    49044922                        return err;
    49054923
    49064924                if (!(hdsp->state & HDSP_InitializationComplete)) {
    4907                         if ((err = snd_hdsp_enable_io(hdsp)) < 0)
     4925                        err = snd_hdsp_enable_io(hdsp);
     4926                        if (err < 0)
    49084927                                return err;
    49094928
     
    49114930                        snd_hdsp_initialize_midi_flush(hdsp);
    49124931
    4913                         if ((err = snd_hdsp_create_alsa_devices(hdsp->card, hdsp)) < 0) {
     4932                        err = snd_hdsp_create_alsa_devices(hdsp->card, hdsp);
     4933                        if (err < 0) {
    49144934                                dev_err(hdsp->card->dev,
    49154935                                        "error creating alsa devices\n");
     
    49614981        int err;
    49624982
    4963         if ((err = snd_hwdep_new(card, "HDSP hwdep", 0, &hw)) < 0)
     4983        err = snd_hwdep_new(card, "HDSP hwdep", 0, &hw);
     4984        if (err < 0)
    49644985                return err;
    49654986
     
    49795000        int err;
    49805001
    4981         if ((err = snd_pcm_new(card, hdsp->card_name, 0, 1, 1, &pcm)) < 0)
     5002        err = snd_pcm_new(card, hdsp->card_name, 0, 1, 1, &pcm);
     5003        if (err < 0)
    49825004                return err;
    49835005
     
    50855107        int err;
    50865108
    5087         if ((err = snd_hdsp_create_pcm(card, hdsp)) < 0) {
     5109        err = snd_hdsp_create_pcm(card, hdsp);
     5110        if (err < 0) {
    50885111                dev_err(card->dev,
    50895112                        "Error creating pcm interface\n");
     
    50925115
    50935116
    5094         if ((err = snd_hdsp_create_midi(card, hdsp, 0)) < 0) {
     5117        err = snd_hdsp_create_midi(card, hdsp, 0);
     5118        if (err < 0) {
    50955119                dev_err(card->dev,
    50965120                        "Error creating first midi interface\n");
     
    50995123
    51005124        if (hdsp->io_type == Digiface || hdsp->io_type == H9652) {
    5101                 if ((err = snd_hdsp_create_midi(card, hdsp, 1)) < 0) {
     5125                err = snd_hdsp_create_midi(card, hdsp, 1);
     5126                if (err < 0) {
    51025127                        dev_err(card->dev,
    51035128                                "Error creating second midi interface\n");
     
    51065131        }
    51075132
    5108         if ((err = snd_hdsp_create_controls(card, hdsp)) < 0) {
     5133        err = snd_hdsp_create_controls(card, hdsp);
     5134        if (err < 0) {
    51095135                dev_err(card->dev,
    51105136                        "Error creating ctl interface\n");
     
    51205146        hdsp->playback_substream = NULL;
    51215147
    5122         if ((err = snd_hdsp_set_defaults(hdsp)) < 0) {
     5148        err = snd_hdsp_set_defaults(hdsp);
     5149        if (err < 0) {
    51235150                dev_err(card->dev,
    51245151                        "Error setting default values\n");
     
    51315158                        hdsp->port, hdsp->irq);
    51325159
    5133                 if ((err = snd_card_register(card)) < 0) {
     5160                err = snd_card_register(card);
     5161                if (err < 0) {
    51345162                        dev_err(card->dev,
    51355163                                "error registering card\n");
     
    51525180                return 0;
    51535181        if (hdsp->io_type == Undefined) {
    5154                 if ((err = hdsp_get_iobox_version(hdsp)) < 0)
     5182                err = hdsp_get_iobox_version(hdsp);
     5183                if (err < 0)
    51555184                        return err;
    51565185                if (hdsp->io_type == H9652 || hdsp->io_type == H9632)
     
    51985227        hdsp->state |= HDSP_FirmwareCached;
    51995228
    5200         if ((err = snd_hdsp_load_firmware_from_cache(hdsp)) < 0)
     5229        err = snd_hdsp_load_firmware_from_cache(hdsp);
     5230        if (err < 0)
    52015231                return err;
    52025232
    52035233        if (!(hdsp->state & HDSP_InitializationComplete)) {
    5204                 if ((err = snd_hdsp_enable_io(hdsp)) < 0)
     5234                err = snd_hdsp_enable_io(hdsp);
     5235                if (err < 0)
    52055236                        return err;
    52065237
    5207                 if ((err = snd_hdsp_create_hwdep(hdsp->card, hdsp)) < 0) {
     5238                err = snd_hdsp_create_hwdep(hdsp->card, hdsp);
     5239                if (err < 0) {
    52085240                        dev_err(hdsp->card->dev,
    52095241                                "error creating hwdep device\n");
     
    52125244                snd_hdsp_initialize_channels(hdsp);
    52135245                snd_hdsp_initialize_midi_flush(hdsp);
    5214                 if ((err = snd_hdsp_create_alsa_devices(hdsp->card, hdsp)) < 0) {
     5246                err = snd_hdsp_create_alsa_devices(hdsp->card, hdsp);
     5247                if (err < 0) {
    52155248                        dev_err(hdsp->card->dev,
    52165249                                "error creating alsa devices\n");
     
    52815314        }
    52825315
    5283         if ((err = pci_enable_device(pci)) < 0)
     5316        err = pci_enable_device(pci);
     5317        if (err < 0)
    52845318                return err;
    52855319
    52865320        pci_set_master(hdsp->pci);
    52875321
    5288         if ((err = pci_request_regions(pci, "hdsp")) < 0)
     5322        err = pci_request_regions(pci, "hdsp");
     5323        if (err < 0)
    52895324                return err;
    52905325        hdsp->port = pci_resource_start(pci, 0);
    5291         if ((hdsp->iobase = ioremap(hdsp->port, HDSP_IO_EXTENT)) == NULL) {
     5326        hdsp->iobase = ioremap(hdsp->port, HDSP_IO_EXTENT);
     5327        if (!hdsp->iobase) {
    52925328                dev_err(hdsp->card->dev, "unable to remap region 0x%lx-0x%lx\n",
    52935329                        hdsp->port, hdsp->port + HDSP_IO_EXTENT - 1);
     
    53075343        hdsp->dds_value = 0;
    53085344
    5309         if ((err = snd_hdsp_initialize_memory(hdsp)) < 0)
     5345        err = snd_hdsp_initialize_memory(hdsp);
     5346        if (err < 0)
    53105347                return err;
    53115348
     
    53195356
    53205357                if ((hdsp_read (hdsp, HDSP_statusRegister) & HDSP_DllError) != 0) {
    5321                         if ((err = hdsp_request_fw_loader(hdsp)) < 0)
     5358                        err = hdsp_request_fw_loader(hdsp);
     5359                        if (err < 0)
    53225360                                /* we don't fail as this can happen
    53235361                                   if userspace is not ready for
     
    53325370                        dev_info(hdsp->card->dev,
    53335371                                 "card initialization pending : waiting for firmware\n");
    5334                         if ((err = snd_hdsp_create_hwdep(card, hdsp)) < 0)
     5372                        err = snd_hdsp_create_hwdep(card, hdsp);
     5373                        if (err < 0)
    53355374                                return err;
    53365375                        return 0;
     
    53475386        }
    53485387
    5349         if ((err = snd_hdsp_enable_io(hdsp)) != 0)
     5388        err = snd_hdsp_enable_io(hdsp);
     5389        if (err)
    53505390                return err;
    53515391
     
    53565396                hdsp->io_type = H9632;
    53575397
    5358         if ((err = snd_hdsp_create_hwdep(card, hdsp)) < 0)
     5398        err = snd_hdsp_create_hwdep(card, hdsp);
     5399        if (err < 0)
    53595400                return err;
    53605401
     
    53645405        hdsp->state |= HDSP_FirmwareLoaded;
    53655406
    5366         if ((err = snd_hdsp_create_alsa_devices(card, hdsp)) < 0)
     5407        err = snd_hdsp_create_alsa_devices(card, hdsp);
     5408        if (err < 0)
    53675409                return err;
    53685410
  • GPL/trunk/alsa-kernel/pci/rme9652/rme9652.c

    r695 r703  
    434434        spin_lock_irq(&s->lock);
    435435
    436         if ((restart = s->running)) {
     436        restart = s->running;
     437        if (restart)
    437438                rme9652_stop(s);
    438         }
    439439
    440440        frames >>= 7;
     
    519519        }
    520520
    521         if ((restart = rme9652->running)) {
     521        restart = rme9652->running;
     522        if (restart)
    522523                rme9652_stop(rme9652);
    523         }
    524524        rme9652->control_register &= ~(RME9652_freq | RME9652_DS);
    525525        rme9652->control_register |= rate;
    526526        rme9652_write(rme9652, RME9652_control_register, rme9652->control_register);
    527527
    528         if (restart) {
     528        if (restart)
    529529                rme9652_start(rme9652);
    530         }
    531530
    532531        if (rate & RME9652_DS) {
     
    879878        /* XXX do we actually need to stop the card when we do this ? */
    880879
    881         if ((restart = rme9652->running)) {
     880        restart = rme9652->running;
     881        if (restart)
    882882                rme9652_stop(rme9652);
    883         }
    884883
    885884        rme9652_write(rme9652, RME9652_control_register, rme9652->control_register);
    886885
    887         if (restart) {
     886        if (restart)
    888887                rme9652_start(rme9652);
    889         }
    890888
    891889        return 0;
     
    944942        rme9652->control_register |= rme9652_encode_spdif_in(in);
    945943
    946         if ((restart = rme9652->running)) {
     944        restart = rme9652->running;
     945        if (restart)
    947946                rme9652_stop(rme9652);
    948         }
    949947
    950948        rme9652_write(rme9652, RME9652_control_register, rme9652->control_register);
    951949
    952         if (restart) {
     950        if (restart)
    953951                rme9652_start(rme9652);
    954         }
    955952
    956953        return 0;
     
    10111008        }
    10121009
    1013         if ((restart = rme9652->running)) {
     1010        restart = rme9652->running;
     1011        if (restart)
    10141012                rme9652_stop(rme9652);
    1015         }
    10161013
    10171014        rme9652_write(rme9652, RME9652_control_register, rme9652->control_register);
    10181015
    1019         if (restart) {
     1016        if (restart)
    10201017                rme9652_start(rme9652);
    1021         }
    10221018
    10231019        return 0;
     
    10871083        }
    10881084
    1089         if ((restart = rme9652->running)) {
     1085        restart = rme9652->running;
     1086        if (restart)
    10901087                rme9652_stop(rme9652);
    1091         }
    10921088
    10931089        rme9652_write(rme9652, RME9652_control_register, rme9652->control_register);
    10941090
    1095         if (restart) {
     1091        if (restart)
    10961092                rme9652_start(rme9652);
    1097         }
    10981093
    10991094        return 0;
     
    11741169        }
    11751170
    1176         if ((restart = rme9652->running)) {
     1171        restart = rme9652->running;
     1172        if (restart)
    11771173                rme9652_stop(rme9652);
    1178         }
    11791174
    11801175        rme9652_write(rme9652, RME9652_control_register, rme9652->control_register);
    11811176
    1182         if (restart) {
     1177        if (restart)
    11831178                rme9652_start(rme9652);
    1184         }
    11851179
    11861180        return 0;
     
    15141508
    15151509        for (idx = 0; idx < ARRAY_SIZE(snd_rme9652_controls); idx++) {
    1516                 if ((err = snd_ctl_add(card, kctl = snd_ctl_new1(&snd_rme9652_controls[idx], rme9652))) < 0)
     1510                kctl = snd_ctl_new1(&snd_rme9652_controls[idx], rme9652);
     1511                err = snd_ctl_add(card, kctl);
     1512                if (err < 0)
    15171513                        return err;
    15181514                if (idx == 1)   /* IEC958 (S/PDIF) Stream */
     
    15201516        }
    15211517
    1522         if (rme9652->ss_channels == RME9652_NCHANNELS)
    1523                 if ((err = snd_ctl_add(card, kctl = snd_ctl_new1(&snd_rme9652_adat3_check, rme9652))) < 0)
     1518        if (rme9652->ss_channels == RME9652_NCHANNELS) {
     1519                kctl = snd_ctl_new1(&snd_rme9652_adat3_check, rme9652);
     1520                err = snd_ctl_add(card, kctl);
     1521                if (err < 0)
    15241522                        return err;
    1525 
    1526         if (rme9652->hw_rev >= 15)
    1527                 if ((err = snd_ctl_add(card, kctl = snd_ctl_new1(&snd_rme9652_adat1_input, rme9652))) < 0)
     1523        }
     1524
     1525        if (rme9652->hw_rev >= 15) {
     1526                kctl = snd_ctl_new1(&snd_rme9652_adat1_input, rme9652);
     1527                err = snd_ctl_add(card, kctl);
     1528                if (err < 0)
    15281529                        return err;
     1530        }
    15291531
    15301532        return 0;
     
    18431845                return NULL;
    18441846       
    1845         if ((mapped_channel = rme9652->channel_map[channel]) < 0) {
     1847        mapped_channel = rme9652->channel_map[channel];
     1848        if (mapped_channel < 0)
    18461849                return NULL;
    1847         }
    18481850       
    18491851        if (stream == SNDRV_PCM_STREAM_CAPTURE) {
     
    20222024         */
    20232025
    2024         if ((err = rme9652_set_rate(rme9652, params_rate(params))) < 0) {
     2026        err = rme9652_set_rate(rme9652, params_rate(params));
     2027        if (err < 0) {
    20252028                _snd_pcm_hw_param_setempty(params, SNDRV_PCM_HW_PARAM_RATE);
    20262029                return err;
    20272030        }
    20282031
    2029         if ((err = rme9652_set_interrupt_interval(rme9652, params_period_size(params))) < 0) {
     2032        err = rme9652_set_interrupt_interval(rme9652, params_period_size(params));
     2033        if (err < 0) {
    20302034                _snd_pcm_hw_param_setempty(params, SNDRV_PCM_HW_PARAM_PERIOD_SIZE);
    20312035                return err;
     
    24072411        int err;
    24082412
    2409         if ((err = snd_pcm_new(card,
    2410                                rme9652->card_name,
    2411                                0, 1, 1, &pcm)) < 0) {
     2413        err = snd_pcm_new(card, rme9652->card_name, 0, 1, 1, &pcm);
     2414        if (err < 0)
    24122415                return err;
    2413         }
    24142416
    24152417        rme9652->pcm = pcm;
     
    24512453        }
    24522454
    2453         if ((err = pci_enable_device(pci)) < 0)
     2455        err = pci_enable_device(pci);
     2456        if (err < 0)
    24542457                return err;
    24552458
    24562459        spin_lock_init(&rme9652->lock);
    24572460
    2458         if ((err = pci_request_regions(pci, "rme9652")) < 0)
     2461        err = pci_request_regions(pci, "rme9652");
     2462        if (err < 0)
    24592463                return err;
    24602464        rme9652->port = pci_resource_start(pci, 0);
     
    25292533        pci_set_master(rme9652->pci);
    25302534
    2531         if ((err = snd_rme9652_initialize_memory(rme9652)) < 0) {
     2535        err = snd_rme9652_initialize_memory(rme9652);
     2536        if (err < 0)
    25322537                return err;
    2533         }
    2534 
    2535         if ((err = snd_rme9652_create_pcm(card, rme9652)) < 0) {
     2538
     2539        err = snd_rme9652_create_pcm(card, rme9652);
     2540        if (err < 0)
    25362541                return err;
    2537         }
    2538 
    2539         if ((err = snd_rme9652_create_controls(card, rme9652)) < 0) {
     2542
     2543        err = snd_rme9652_create_controls(card, rme9652);
     2544        if (err < 0)
    25402545                return err;
    2541         }
    25422546
    25432547        snd_rme9652_proc_init(rme9652);
  • GPL/trunk/alsa-kernel/pci/sonicvibes.c

    r695 r703  
    853853        int err;
    854854
    855         if ((err = snd_pcm_new(sonic->card, "s3_86c617", device, 1, 1, &pcm)) < 0)
     855        err = snd_pcm_new(sonic->card, "s3_86c617", device, 1, 1, &pcm);
     856        if (err < 0)
    856857                return err;
    857858        if (snd_BUG_ON(!pcm))
     
    10941095
    10951096        for (idx = 0; idx < ARRAY_SIZE(snd_sonicvibes_controls); idx++) {
    1096                 if ((err = snd_ctl_add(card, kctl = snd_ctl_new1(&snd_sonicvibes_controls[idx], sonic))) < 0)
     1097                kctl = snd_ctl_new1(&snd_sonicvibes_controls[idx], sonic);
     1098                err = snd_ctl_add(card, kctl);
     1099                if (err < 0)
    10971100                        return err;
    10981101                switch (idx) {
     
    12271230        *rsonic = NULL;
    12281231        /* enable PCI device */
    1229         if ((err = pci_enable_device(pci)) < 0)
     1232        err = pci_enable_device(pci);
     1233        if (err < 0)
    12301234                return err;
    12311235        /* check, if we can restrict PCI DMA transfers to 24 bits */
     
    12471251        sonic->irq = -1;
    12481252
    1249         if ((err = pci_request_regions(pci, "S3 SonicVibes")) < 0) {
     1253        err = pci_request_regions(pci, "S3 SonicVibes");
     1254        if (err < 0) {
    12501255                kfree(sonic);
    12511256                pci_disable_device(pci);
     
    12901295        pci_write_config_dword(pci, 0x48, dmac);
    12911296
    1292         if ((sonic->res_dmaa = request_region(dmaa, 0x10, "S3 SonicVibes DDMA-A")) == NULL) {
     1297        sonic->res_dmaa = request_region(dmaa, 0x10, "S3 SonicVibes DDMA-A");
     1298        if (!sonic->res_dmaa) {
    12931299                snd_sonicvibes_free(sonic);
    12941300                dev_err(card->dev,
     
    12971303                return -EBUSY;
    12981304        }
    1299         if ((sonic->res_dmac = request_region(dmac, 0x10, "S3 SonicVibes DDMA-C")) == NULL) {
     1305        sonic->res_dmac = request_region(dmac, 0x10, "S3 SonicVibes DDMA-C");
     1306        if (!sonic->res_dmac) {
    13001307                snd_sonicvibes_free(sonic);
    13011308                dev_err(card->dev,
     
    13591366        sonic->revision = snd_sonicvibes_in(sonic, SV_IREG_REVISION);
    13601367
    1361         if ((err = snd_device_new(card, SNDRV_DEV_LOWLEVEL, sonic, &ops)) < 0) {
     1368        err = snd_device_new(card, SNDRV_DEV_LOWLEVEL, sonic, &ops);
     1369        if (err < 0) {
    13621370                snd_sonicvibes_free(sonic);
    13631371                return err;
     
    14061414        mpu->open_input = snd_sonicvibes_midi_input_open;
    14071415        mpu->close_input = snd_sonicvibes_midi_input_close;
    1408         for (idx = 0; idx < ARRAY_SIZE(snd_sonicvibes_midi_controls); idx++)
    1409                 if ((err = snd_ctl_add(card, snd_ctl_new1(&snd_sonicvibes_midi_controls[idx], sonic))) < 0)
     1416        for (idx = 0; idx < ARRAY_SIZE(snd_sonicvibes_midi_controls); idx++) {
     1417                err = snd_ctl_add(card, snd_ctl_new1(&snd_sonicvibes_midi_controls[idx], sonic));
     1418                if (err < 0)
    14101419                        return err;
     1420        }
    14111421        return 0;
    14121422}
     
    14401450                }
    14411451        }
    1442         if ((err = snd_sonicvibes_create(card, pci,
    1443                                          reverb[dev] ? 1 : 0,
    1444                                          mge[dev] ? 1 : 0,
    1445                                          &sonic)) < 0) {
     1452        err = snd_sonicvibes_create(card, pci,
     1453                                    reverb[dev] ? 1 : 0,
     1454                                    mge[dev] ? 1 : 0,
     1455                                    &sonic);
     1456        if (err < 0) {
    14461457                snd_card_free(card);
    14471458                return err;
     
    14561467                sonic->irq);
    14571468
    1458         if ((err = snd_sonicvibes_pcm(sonic, 0)) < 0) {
     1469        err = snd_sonicvibes_pcm(sonic, 0);
     1470        if (err < 0) {
    14591471                snd_card_free(card);
    14601472                return err;
    14611473        }
    1462         if ((err = snd_sonicvibes_mixer(sonic)) < 0) {
     1474        err = snd_sonicvibes_mixer(sonic);
     1475        if (err < 0) {
    14631476                snd_card_free(card);
    14641477                return err;
    14651478        }
    1466         if ((err = snd_mpu401_uart_new(card, 0, MPU401_HW_SONICVIBES,
    1467                                        sonic->midi_port,
    1468                                        MPU401_INFO_INTEGRATED |
    1469                                        MPU401_INFO_IRQ_HOOK,
    1470                                        -1, &midi_uart)) < 0) {
     1479        err = snd_mpu401_uart_new(card, 0, MPU401_HW_SONICVIBES,
     1480                                  sonic->midi_port,
     1481                                  MPU401_INFO_INTEGRATED |
     1482                                  MPU401_INFO_IRQ_HOOK,
     1483                                  -1, &midi_uart);
     1484        if (err < 0) {
    14711485                snd_card_free(card);
    14721486                return err;
    14731487        }
    14741488        snd_sonicvibes_midi(sonic, midi_uart);
    1475         if ((err = snd_opl3_create(card, sonic->synth_port,
    1476                                    sonic->synth_port + 2,
    1477                                    OPL3_HW_OPL3_SV, 1, &opl3)) < 0) {
     1489        err = snd_opl3_create(card, sonic->synth_port,
     1490                              sonic->synth_port + 2,
     1491                              OPL3_HW_OPL3_SV, 1, &opl3);
     1492        if (err < 0) {
    14781493                snd_card_free(card);
    14791494                return err;
    14801495        }
    1481         if ((err = snd_opl3_hwdep_new(opl3, 0, 1, NULL)) < 0) {
     1496        err = snd_opl3_hwdep_new(opl3, 0, 1, NULL);
     1497        if (err < 0) {
    14821498                snd_card_free(card);
    14831499                return err;
     
    14901506        }
    14911507
    1492         if ((err = snd_card_register(card)) < 0) {
     1508        err = snd_card_register(card);
     1509        if (err < 0) {
    14931510                snd_card_free(card);
    14941511                return err;
  • GPL/trunk/alsa-kernel/pci/trident/trident.c

    r695 r703  
    7777                return err;
    7878
    79         if ((err = snd_trident_create(card, pci,
    80                                       pcm_channels[dev],
    81                                       ((pci->vendor << 16) | pci->device) == TRIDENT_DEVICE_ID_SI7018 ? 1 : 2,
    82                                       wavetable_size[dev],
    83                                       &trident)) < 0) {
     79        err = snd_trident_create(card, pci,
     80                                 pcm_channels[dev],
     81                                 ((pci->vendor << 16) | pci->device) == TRIDENT_DEVICE_ID_SI7018 ? 1 : 2,
     82                                 wavetable_size[dev],
     83                                 &trident);
     84        if (err < 0) {
    8485                snd_card_free(card);
    8586                return err;
     
    110111                card->shortname, trident->port, trident->irq);
    111112
    112         if ((err = snd_trident_pcm(trident, pcm_dev++)) < 0) {
     113        err = snd_trident_pcm(trident, pcm_dev++);
     114        if (err < 0) {
    113115                snd_card_free(card);
    114116                return err;
     
    117119        case TRIDENT_DEVICE_ID_DX:
    118120        case TRIDENT_DEVICE_ID_NX:
    119                 if ((err = snd_trident_foldback_pcm(trident, pcm_dev++)) < 0) {
     121                err = snd_trident_foldback_pcm(trident, pcm_dev++);
     122                if (err < 0) {
    120123                        snd_card_free(card);
    121124                        return err;
     
    124127        }
    125128        if (trident->device == TRIDENT_DEVICE_ID_NX || trident->device == TRIDENT_DEVICE_ID_SI7018) {
    126                 if ((err = snd_trident_spdif_pcm(trident, pcm_dev++)) < 0) {
     129                err = snd_trident_spdif_pcm(trident, pcm_dev++);
     130                if (err < 0) {
    127131                        snd_card_free(card);
    128132                        return err;
    129133                }
    130134        }
    131         if (trident->device != TRIDENT_DEVICE_ID_SI7018 &&
    132             (err = snd_mpu401_uart_new(card, 0, MPU401_HW_TRID4DWAVE,
    133                                        trident->midi_port,
    134                                        MPU401_INFO_INTEGRATED |
    135                                        MPU401_INFO_IRQ_HOOK,
    136                                        -1, &trident->rmidi)) < 0) {
    137                 snd_card_free(card);
    138                 return err;
     135        if (trident->device != TRIDENT_DEVICE_ID_SI7018) {
     136                err = snd_mpu401_uart_new(card, 0, MPU401_HW_TRID4DWAVE,
     137                                          trident->midi_port,
     138                                          MPU401_INFO_INTEGRATED |
     139                                          MPU401_INFO_IRQ_HOOK,
     140                                          -1, &trident->rmidi);
     141                if (err < 0) {
     142                        snd_card_free(card);
     143                        return err;
     144                }
    139145        }
    140146
    141147        snd_trident_create_gameport(trident);
    142148
    143         if ((err = snd_card_register(card)) < 0) {
     149        err = snd_card_register(card);
     150        if (err < 0) {
    144151                snd_card_free(card);
    145152                return err;
  • GPL/trunk/alsa-kernel/pci/trident/trident.h

    r679 r703  
    252252        __le32 *entries;                /* 16k-aligned TLB table */
    253253        dma_addr_t entries_dmaaddr;     /* 16k-aligned PCI address to TLB table */
    254         unsigned long * shadow_entries; /* shadow entries with virtual addresses */
    255254        struct snd_dma_buffer buffer;
    256255        struct snd_util_memhdr * memhdr;        /* page allocation list */
  • GPL/trunk/alsa-kernel/pci/trident/trident_main.c

    r695 r703  
    21322132        int err;
    21332133
    2134         if ((err = snd_pcm_new(trident->card, "trident_dx_nx", device, trident->ChanPCM, 1, &pcm)) < 0)
     2134        err = snd_pcm_new(trident->card, "trident_dx_nx", device, trident->ChanPCM, 1, &pcm);
     2135        if (err < 0)
    21352136                return err;
    21362137
     
    21912192        if (trident->device == TRIDENT_DEVICE_ID_NX)
    21922193                num_chan = 4;
    2193         if ((err = snd_pcm_new(trident->card, "trident_dx_nx", device, 0, num_chan, &foldback)) < 0)
     2194        err = snd_pcm_new(trident->card, "trident_dx_nx", device, 0, num_chan, &foldback);
     2195        if (err < 0)
    21942196                return err;
    21952197
     
    22412243        int err;
    22422244
    2243         if ((err = snd_pcm_new(trident->card, "trident_dx_nx IEC958", device, 1, 0, &spdif)) < 0)
     2245        err = snd_pcm_new(trident->card, "trident_dx_nx IEC958", device, 1, 0, &spdif);
     2246        if (err < 0)
    22442247                return err;
    22452248
     
    29342937                return -ENOMEM;
    29352938
    2936         if ((err = snd_ac97_bus(trident->card, 0, &ops, NULL, &trident->ac97_bus)) < 0)
     2939        err = snd_ac97_bus(trident->card, 0, &ops, NULL, &trident->ac97_bus);
     2940        if (err < 0)
    29372941                goto __out;
    29382942
     
    29422946
    29432947      __again:
    2944         if ((err = snd_ac97_mixer(trident->ac97_bus, &_ac97, &trident->ac97)) < 0) {
     2948        err = snd_ac97_mixer(trident->ac97_bus, &_ac97, &trident->ac97);
     2949        if (err < 0) {
    29452950                if (trident->device == TRIDENT_DEVICE_ID_SI7018) {
    2946                         if ((err = snd_trident_sis_reset(trident)) < 0)
     2951                        err = snd_trident_sis_reset(trident);
     2952                        if (err < 0)
    29472953                                goto __out;
    29482954                        if (retries-- > 0)
     
    29752981
    29762982        if (trident->device != TRIDENT_DEVICE_ID_SI7018) {
    2977                 if ((err = snd_ctl_add(card, kctl = snd_ctl_new1(&snd_trident_vol_wave_control, trident))) < 0)
     2983                kctl = snd_ctl_new1(&snd_trident_vol_wave_control, trident);
     2984                err = snd_ctl_add(card, kctl);
     2985                if (err < 0)
    29782986                        goto __out;
    29792987                kctl->put(kctl, uctl);
    2980                 if ((err = snd_ctl_add(card, kctl = snd_ctl_new1(&snd_trident_vol_music_control, trident))) < 0)
     2988                kctl = snd_ctl_new1(&snd_trident_vol_music_control, trident);
     2989                err = snd_ctl_add(card, kctl);
     2990                if (err < 0)
    29812991                        goto __out;
    29822992                kctl->put(kctl, uctl);
     
    29923002                tmix->voice = NULL;
    29933003        }
    2994         if ((trident->ctl_vol = snd_ctl_new1(&snd_trident_pcm_vol_control, trident)) == NULL)
     3004        trident->ctl_vol = snd_ctl_new1(&snd_trident_pcm_vol_control, trident);
     3005        if (!trident->ctl_vol)
    29953006                goto __nomem;
    2996         if ((err = snd_ctl_add(card, trident->ctl_vol)))
     3007        err = snd_ctl_add(card, trident->ctl_vol);
     3008        if (err)
    29973009                goto __out;
    29983010               
    2999         if ((trident->ctl_pan = snd_ctl_new1(&snd_trident_pcm_pan_control, trident)) == NULL)
     3011        trident->ctl_pan = snd_ctl_new1(&snd_trident_pcm_pan_control, trident);
     3012        if (!trident->ctl_pan)
    30003013                goto __nomem;
    3001         if ((err = snd_ctl_add(card, trident->ctl_pan)))
     3014        err = snd_ctl_add(card, trident->ctl_pan);
     3015        if (err)
    30023016                goto __out;
    30033017
    3004         if ((trident->ctl_rvol = snd_ctl_new1(&snd_trident_pcm_rvol_control, trident)) == NULL)
     3018        trident->ctl_rvol = snd_ctl_new1(&snd_trident_pcm_rvol_control, trident);
     3019        if (!trident->ctl_rvol)
    30053020                goto __nomem;
    3006         if ((err = snd_ctl_add(card, trident->ctl_rvol)))
     3021        err = snd_ctl_add(card, trident->ctl_rvol);
     3022        if (err)
    30073023                goto __out;
    30083024
    3009         if ((trident->ctl_cvol = snd_ctl_new1(&snd_trident_pcm_cvol_control, trident)) == NULL)
     3025        trident->ctl_cvol = snd_ctl_new1(&snd_trident_pcm_cvol_control, trident);
     3026        if (!trident->ctl_cvol)
    30103027                goto __nomem;
    3011         if ((err = snd_ctl_add(card, trident->ctl_cvol)))
     3028        err = snd_ctl_add(card, trident->ctl_cvol);
     3029        if (err)
    30123030                goto __out;
    30133031
    30143032        if (trident->device == TRIDENT_DEVICE_ID_NX) {
    3015                 if ((err = snd_ctl_add(card, kctl = snd_ctl_new1(&snd_trident_ac97_rear_control, trident))) < 0)
     3033                kctl = snd_ctl_new1(&snd_trident_ac97_rear_control, trident);
     3034                err = snd_ctl_add(card, kctl);
     3035                if (err < 0)
    30163036                        goto __out;
    30173037                kctl->put(kctl, uctl);
     
    30293049                        kctl->id.index++;
    30303050                idx = kctl->id.index;
    3031                 if ((err = snd_ctl_add(card, kctl)) < 0)
     3051                err = snd_ctl_add(card, kctl);
     3052                if (err < 0)
    30323053                        goto __out;
    30333054                kctl->put(kctl, uctl);
     
    30403061                kctl->id.index = idx;
    30413062                kctl->id.device = pcm_spdif_device;
    3042                 if ((err = snd_ctl_add(card, kctl)) < 0)
     3063                err = snd_ctl_add(card, kctl);
     3064                if (err < 0)
    30433065                        goto __out;
    30443066
     
    30503072                kctl->id.index = idx;
    30513073                kctl->id.device = pcm_spdif_device;
    3052                 if ((err = snd_ctl_add(card, kctl)) < 0)
     3074                err = snd_ctl_add(card, kctl);
     3075                if (err < 0)
    30533076                        goto __out;
    30543077
     
    30603083                kctl->id.index = idx;
    30613084                kctl->id.device = pcm_spdif_device;
    3062                 if ((err = snd_ctl_add(card, kctl)) < 0)
     3085                err = snd_ctl_add(card, kctl);
     3086                if (err < 0)
    30633087                        goto __out;
    30643088                trident->spdif_pcm_ctl = kctl;
     
    33203344        trident->tlb.entries = (__le32 *)ALIGN((unsigned long)trident->tlb.buffer.area, SNDRV_TRIDENT_MAX_PAGES * 4);
    33213345        trident->tlb.entries_dmaaddr = ALIGN(trident->tlb.buffer.addr, SNDRV_TRIDENT_MAX_PAGES * 4);
    3322         /* allocate shadow TLB page table (virtual addresses) */
    3323         trident->tlb.shadow_entries =
    3324                 vmalloc(array_size(SNDRV_TRIDENT_MAX_PAGES,
    3325                                    sizeof(unsigned long)));
    3326         if (!trident->tlb.shadow_entries)
    3327                 return -ENOMEM;
    33283346
    33293347        /* allocate and setup silent page and initialise TLB entries */
     
    33343352        }
    33353353        memset(trident->tlb.silent_page.area, 0, SNDRV_TRIDENT_PAGE_SIZE);
    3336         for (i = 0; i < SNDRV_TRIDENT_MAX_PAGES; i++) {
     3354        for (i = 0; i < SNDRV_TRIDENT_MAX_PAGES; i++)
    33373355                trident->tlb.entries[i] = cpu_to_le32(trident->tlb.silent_page.addr & ~(SNDRV_TRIDENT_PAGE_SIZE-1));
    3338                 trident->tlb.shadow_entries[i] = (unsigned long)trident->tlb.silent_page.area;
    3339         }
    33403356
    33413357        /* use emu memory block manager code to manage tlb page allocation */
     
    34623478        int err;
    34633479
    3464         if ((err = snd_trident_sis_reset(trident)) < 0)
     3480        err = snd_trident_sis_reset(trident);
     3481        if (err < 0)
    34653482                return err;
    34663483
     
    35073524
    35083525        /* enable PCI device */
    3509         if ((err = pci_enable_device(pci)) < 0)
     3526        err = pci_enable_device(pci);
     3527        if (err < 0)
    35103528                return err;
    35113529        /* check, if we can restrict PCI DMA transfers to 30 bits */
     
    35413559        pci_set_master(pci);
    35423560
    3543         if ((err = pci_request_regions(pci, "Trident Audio")) < 0) {
     3561        err = pci_request_regions(pci, "Trident Audio");
     3562        if (err < 0) {
    35443563                kfree(trident);
    35453564                pci_disable_device(pci);
     
    35613580        trident->tlb.buffer.area = NULL;
    35623581        if (trident->device == TRIDENT_DEVICE_ID_NX) {
    3563                 if ((err = snd_trident_tlb_alloc(trident)) < 0) {
     3582                err = snd_trident_tlb_alloc(trident);
     3583                if (err < 0) {
    35643584                        snd_trident_free(trident);
    35653585                        return err;
     
    35893609        }
    35903610
    3591         if ((err = snd_device_new(card, SNDRV_DEV_LOWLEVEL, trident, &ops)) < 0) {
     3611        err = snd_device_new(card, SNDRV_DEV_LOWLEVEL, trident, &ops);
     3612        if (err < 0) {
    35923613                snd_trident_free(trident);
    35933614                return err;
    35943615        }
    35953616
    3596         if ((err = snd_trident_mixer(trident, pcm_spdif_device)) < 0)
     3617        err = snd_trident_mixer(trident, pcm_spdif_device);
     3618        if (err < 0)
    35973619                return err;
    35983620       
     
    36483670                if (trident->tlb.silent_page.area)
    36493671                        snd_dma_free_pages(&trident->tlb.silent_page);
    3650                 vfree(trident->tlb.shadow_entries);
    36513672                snd_dma_free_pages(&trident->tlb.buffer);
    36523673        }
  • GPL/trunk/alsa-kernel/pci/trident/trident_memory.c

    r679 r703  
    2020 * aligned pages in others
    2121 */
    22 #define __set_tlb_bus(trident,page,ptr,addr) \
    23         do { (trident)->tlb.entries[page] = cpu_to_le32((addr) & ~(SNDRV_TRIDENT_PAGE_SIZE-1)); \
    24              (trident)->tlb.shadow_entries[page] = (ptr); } while (0)
    25 #define __tlb_to_ptr(trident,page) \
    26         (void*)((trident)->tlb.shadow_entries[page])
     22#define __set_tlb_bus(trident,page,addr) \
     23        (trident)->tlb.entries[page] = cpu_to_le32((addr) & ~(SNDRV_TRIDENT_PAGE_SIZE-1))
    2724#define __tlb_to_addr(trident,page) \
    2825        (dma_addr_t)le32_to_cpu((trident->tlb.entries[page]) & ~(SNDRV_TRIDENT_PAGE_SIZE - 1))
     
    3330#define MAX_ALIGN_PAGES         SNDRV_TRIDENT_MAX_PAGES /* maxmium aligned pages */
    3431/* fill TLB entrie(s) corresponding to page with ptr */
    35 #define set_tlb_bus(trident,page,ptr,addr) __set_tlb_bus(trident,page,ptr,addr)
     32#define set_tlb_bus(trident,page,addr) __set_tlb_bus(trident,page,addr)
    3633/* fill TLB entrie(s) corresponding to page with silence pointer */
    37 #define set_silent_tlb(trident,page)    __set_tlb_bus(trident, page, (unsigned long)trident->tlb.silent_page.area, trident->tlb.silent_page.addr)
     34#define set_silent_tlb(trident,page)    __set_tlb_bus(trident, page, trident->tlb.silent_page.addr)
    3835/* get aligned page from offset address */
    3936#define get_aligned_page(offset)        ((offset) >> 12)
    4037/* get offset address from aligned page */
    4138#define aligned_page_offset(page)       ((page) << 12)
    42 /* get buffer address from aligned page */
    43 #define page_to_ptr(trident,page)       __tlb_to_ptr(trident, page)
    4439/* get PCI physical address from aligned page */
    4540#define page_to_addr(trident,page)      __tlb_to_addr(trident, page)
     
    5146#define get_aligned_page(offset)        ((offset) >> 13)
    5247#define aligned_page_offset(page)       ((page) << 13)
    53 #define page_to_ptr(trident,page)       __tlb_to_ptr(trident, (page) << 1)
    5448#define page_to_addr(trident,page)      __tlb_to_addr(trident, (page) << 1)
    5549
    5650/* fill TLB entries -- we need to fill two entries */
    5751static inline void set_tlb_bus(struct snd_trident *trident, int page,
    58                                unsigned long ptr, dma_addr_t addr)
     52                               dma_addr_t addr)
    5953{
    6054        page <<= 1;
    61         __set_tlb_bus(trident, page, ptr, addr);
    62         __set_tlb_bus(trident, page+1, ptr + SNDRV_TRIDENT_PAGE_SIZE, addr + SNDRV_TRIDENT_PAGE_SIZE);
     55        __set_tlb_bus(trident, page, addr);
     56        __set_tlb_bus(trident, page+1, addr + SNDRV_TRIDENT_PAGE_SIZE);
    6357}
    6458static inline void set_silent_tlb(struct snd_trident *trident, int page)
    6559{
    6660        page <<= 1;
    67         __set_tlb_bus(trident, page, (unsigned long)trident->tlb.silent_page.area, trident->tlb.silent_page.addr);
    68         __set_tlb_bus(trident, page+1, (unsigned long)trident->tlb.silent_page.area, trident->tlb.silent_page.addr);
     61        __set_tlb_bus(trident, page, trident->tlb.silent_page.addr);
     62        __set_tlb_bus(trident, page+1, trident->tlb.silent_page.addr);
    6963}
    7064
     
    8175#define get_aligned_page(offset)        ((offset) / ALIGN_PAGE_SIZE)
    8276#define aligned_page_offset(page)       ((page) * ALIGN_PAGE_SIZE)
    83 #define page_to_ptr(trident,page)       __tlb_to_ptr(trident, (page) * UNIT_PAGES)
    8477#define page_to_addr(trident,page)      __tlb_to_addr(trident, (page) * UNIT_PAGES)
    8578
    8679/* fill TLB entries -- UNIT_PAGES entries must be filled */
    8780static inline void set_tlb_bus(struct snd_trident *trident, int page,
    88                                unsigned long ptr, dma_addr_t addr)
     81                               dma_addr_t addr)
    8982{
    9083        int i;
    9184        page *= UNIT_PAGES;
    9285        for (i = 0; i < UNIT_PAGES; i++, page++) {
    93                 __set_tlb_bus(trident, page, ptr, addr);
    94                 ptr += SNDRV_TRIDENT_PAGE_SIZE;
     86                __set_tlb_bus(trident, page, addr);
    9587                addr += SNDRV_TRIDENT_PAGE_SIZE;
    9688        }
     
    10193        page *= UNIT_PAGES;
    10294        for (i = 0; i < UNIT_PAGES; i++, page++)
    103                 __set_tlb_bus(trident, page, (unsigned long)trident->tlb.silent_page.area, trident->tlb.silent_page.addr);
     95                __set_tlb_bus(trident, page, trident->tlb.silent_page.addr);
    10496}
    10597
    10698#endif /* PAGE_SIZE */
    107 
    108 /* calculate buffer pointer from offset address */
    109 static inline void *offset_ptr(struct snd_trident *trident, int offset)
    110 {
    111         char *ptr;
    112         ptr = page_to_ptr(trident, get_aligned_page(offset));
    113         ptr += offset % ALIGN_PAGE_SIZE;
    114         return (void*)ptr;
    115 }
    11699
    117100/* first and last (aligned) pages of memory block */
     
    204187                unsigned long ofs = idx << PAGE_SHIFT;
    205188                dma_addr_t addr = snd_pcm_sgbuf_get_addr(substream, ofs);
    206                 unsigned long ptr = (unsigned long)
    207                         snd_pcm_sgbuf_get_ptr(substream, ofs);
    208189                if (! is_valid_page(addr)) {
    209190                        __snd_util_mem_free(hdr, blk);
     
    211192                        return NULL;
    212193                }
    213                 set_tlb_bus(trident, page, ptr, addr);
     194                set_tlb_bus(trident, page, addr);
    214195        }
    215196        mutex_unlock(&hdr->block_mutex);
     
    229210        struct snd_pcm_runtime *runtime = substream->runtime;
    230211        dma_addr_t addr;
    231         unsigned long ptr;
    232212
    233213#pragma disable_message (136)
     
    250230        /* set TLB entries */
    251231        addr = runtime->dma_addr;
    252         ptr = (unsigned long)runtime->dma_area;
    253232        for (page = firstpg(blk); page <= lastpg(blk); page++,
    254              ptr += SNDRV_TRIDENT_PAGE_SIZE, addr += SNDRV_TRIDENT_PAGE_SIZE) {
     233             addr += SNDRV_TRIDENT_PAGE_SIZE) {
    255234                if (! is_valid_page(addr)) {
    256235                        __snd_util_mem_free(hdr, blk);
     
    258237                        return NULL;
    259238                }
    260                 set_tlb_bus(trident, page, ptr, addr);
     239                set_tlb_bus(trident, page, addr);
    261240        }
    262241        mutex_unlock(&hdr->block_mutex);
  • GPL/trunk/alsa-kernel/pci/via82xx.c

    r695 r703  
    520520        while (timeout-- > 0) {
    521521                udelay(1);
    522                 if (!((val = snd_via82xx_codec_xread(chip)) & VIA_REG_AC97_BUSY))
     522                val = snd_via82xx_codec_xread(chip);
     523                if (!(val & VIA_REG_AC97_BUSY))
    523524                        return val & 0xffff;
    524525        }
     
    10281029        u32 rbits;
    10291030
    1030         if ((rate_changed = via_lock_rate(&chip->rates[0], ac97_rate)) < 0)
     1031        rate_changed = via_lock_rate(&chip->rates[0], ac97_rate);
     1032        if (rate_changed < 0)
    10311033                return rate_changed;
    10321034        if (rate_changed)
     
    12021204        /* we may remove following constaint when we modify table entries
    12031205           in interrupt */
    1204         if ((err = snd_pcm_hw_constraint_integer(runtime, SNDRV_PCM_HW_PARAM_PERIODS)) < 0)
     1206        err = snd_pcm_hw_constraint_integer(runtime, SNDRV_PCM_HW_PARAM_PERIODS);
     1207        if (err < 0)
    12051208                return err;
    12061209
     
    12271230        int err;
    12281231
    1229         if ((err = snd_via82xx_pcm_open(chip, viadev, substream)) < 0)
     1232        err = snd_via82xx_pcm_open(chip, viadev, substream);
     1233        if (err < 0)
    12301234                return err;
    12311235        return 0;
     
    12431247
    12441248        viadev = &chip->devs[chip->playback_devno + substream->number];
    1245         if ((err = snd_via82xx_pcm_open(chip, viadev, substream)) < 0)
     1249        err = snd_via82xx_pcm_open(chip, viadev, substream);
     1250        if (err < 0)
    12461251                return err;
    12471252        stream = viadev->reg_offset / 0x10;
     
    12801285        };
    12811286
    1282         if ((err = snd_via82xx_pcm_open(chip, viadev, substream)) < 0)
     1287        err = snd_via82xx_pcm_open(chip, viadev, substream);
     1288        if (err < 0)
    12831289                return err;
    12841290        substream->runtime->hw.channels_max = 6;
     
    18801886        };
    18811887
    1882         if ((err = snd_ac97_bus(chip->card, 0, &ops, chip, &chip->ac97_bus)) < 0)
     1888        err = snd_ac97_bus(chip->card, 0, &ops, chip, &chip->ac97_bus);
     1889        if (err < 0)
    18831890                return err;
    18841891        chip->ac97_bus->private_free = snd_via82xx_mixer_free_ac97_bus;
     
    18901897        ac97.pci = chip->pci;
    18911898        ac97.scaps = AC97_SCAP_SKIP_MODEM | AC97_SCAP_POWER_SAVE;
    1892         if ((err = snd_ac97_mixer(chip->ac97_bus, &ac97, &chip->ac97)) < 0)
     1899        err = snd_ac97_mixer(chip->ac97_bus, &ac97, &chip->ac97);
     1900        if (err < 0)
    18931901                return err;
    18941902
     
    20592067                }
    20602068        }
    2061         if (mpu_port >= 0x200 &&
    2062             (chip->mpu_res = request_region(mpu_port, 2, "VIA82xx MPU401"))
    2063             != NULL) {
     2069        if (mpu_port >= 0x200)
     2070                chip->mpu_res = request_region(mpu_port, 2, "VIA82xx MPU401");
     2071        if (chip->mpu_res) {
    20642072                if (rev_h)
    20652073                        legacy |= VIA_FUNC_MIDI_PNP;    /* enable PCI I/O 2 */
     
    21782186        } while (time_before(jiffies, end_time));
    21792187
    2180         if ((val = snd_via82xx_codec_xread(chip)) & VIA_REG_AC97_BUSY)
     2188        val = snd_via82xx_codec_xread(chip);
     2189        if (val & VIA_REG_AC97_BUSY)
    21812190                dev_err(chip->card->dev,
    21822191                        "AC'97 codec is not ready [0x%x]\n", val);
     
    21912200                                 (VIA_REG_AC97_CODEC_ID_SECONDARY << VIA_REG_AC97_CODEC_ID_SHIFT));
    21922201        do {
    2193                 if ((val = snd_via82xx_codec_xread(chip)) & VIA_REG_AC97_SECONDARY_VALID) {
     2202                val = snd_via82xx_codec_xread(chip);
     2203                if (val & VIA_REG_AC97_SECONDARY_VALID) {
    21942204                        chip->ac97_secondary = 1;
    21952205                        goto __ac97_ok2;
     
    23422352        };
    23432353
    2344         if ((err = pci_enable_device(pci)) < 0)
     2354        err = pci_enable_device(pci);
     2355        if (err < 0)
    23452356                return err;
    23462357
    2347         if ((chip = kzalloc(sizeof(*chip), GFP_KERNEL)) == NULL) {
     2358        chip = kzalloc(sizeof(*chip), GFP_KERNEL);
     2359        if (!chip) {
    23482360                pci_disable_device(pci);
    23492361                return -ENOMEM;
     
    23652377                              chip->old_legacy & ~(VIA_FUNC_ENABLE_SB|VIA_FUNC_ENABLE_FM));
    23662378
    2367         if ((err = pci_request_regions(pci, card->driver)) < 0) {
     2379        err = pci_request_regions(pci, card->driver);
     2380        if (err < 0) {
    23682381                kfree(chip);
    23692382                pci_disable_device(pci);
     
    23852398                chip->ac97_clock = ac97_clock;
    23862399
    2387         if ((err = snd_via82xx_chip_init(chip)) < 0) {
     2400        err = snd_via82xx_chip_init(chip);
     2401        if (err < 0) {
    23882402                snd_via82xx_free(chip);
    23892403                return err;
    23902404        }
    23912405
    2392         if ((err = snd_device_new(card, SNDRV_DEV_LOWLEVEL, chip, &ops)) < 0) {
     2406        err = snd_device_new(card, SNDRV_DEV_LOWLEVEL, chip, &ops);
     2407        if (err < 0) {
    23932408                snd_via82xx_free(chip);
    23942409                return err;
     
    25462561        }
    25472562               
    2548         if ((err = snd_via82xx_create(card, pci, chip_type, pci->revision,
    2549                                       ac97_clock, &chip)) < 0)
     2563        err = snd_via82xx_create(card, pci, chip_type, pci->revision,
     2564                                 ac97_clock, &chip);
     2565        if (err < 0)
    25502566                goto __error;
    25512567        card->private_data = chip;
    2552         if ((err = snd_via82xx_mixer_new(chip, ac97_quirk)) < 0)
     2568        err = snd_via82xx_mixer_new(chip, ac97_quirk);
     2569        if (err < 0)
    25532570                goto __error;
    25542571
    25552572        if (chip_type == TYPE_VIA686) {
    2556                 if ((err = snd_via686_pcm_new(chip)) < 0 ||
    2557                     (err = snd_via686_init_misc(chip)) < 0)
     2573                err = snd_via686_pcm_new(chip);
     2574                if (err < 0)
     2575                        goto __error;
     2576                err = snd_via686_init_misc(chip);
     2577                if (err < 0)
    25582578                        goto __error;
    25592579        } else {
    25602580                if (chip_type == TYPE_VIA8233A) {
    2561                         if ((err = snd_via8233a_pcm_new(chip)) < 0)
     2581                        err = snd_via8233a_pcm_new(chip);
     2582                        if (err < 0)
    25622583                                goto __error;
    25632584                        // chip->dxs_fixed = 1; /* FIXME: use 48k for DXS #3? */
    25642585                } else {
    2565                         if ((err = snd_via8233_pcm_new(chip)) < 0)
     2586                        err = snd_via8233_pcm_new(chip);
     2587                        if (err < 0)
    25662588                                goto __error;
    25672589                        if (dxs_support == VIA_DXS_48K)
     
    25742596                        }
    25752597                }
    2576                 if ((err = snd_via8233_init_misc(chip)) < 0)
     2598                err = snd_via8233_init_misc(chip);
     2599                if (err < 0)
    25772600                        goto __error;
    25782601        }
     
    25882611        snd_via82xx_proc_init(chip);
    25892612
    2590         if ((err = snd_card_register(card)) < 0) {
     2613        err = snd_card_register(card);
     2614        if (err < 0) {
    25912615                snd_card_free(card);
    25922616                return err;
  • GPL/trunk/alsa-kernel/pci/via82xx_modem.c

    r695 r703  
    370370        while (timeout-- > 0) {
    371371                udelay(1);
    372                 if (!((val = snd_via82xx_codec_xread(chip)) & VIA_REG_AC97_BUSY))
     372                val = snd_via82xx_codec_xread(chip);
     373                if (!(val & VIA_REG_AC97_BUSY))
    373374                        return val & 0xffff;
    374375        }
     
    739740        runtime->hw = snd_via82xx_hw;
    740741       
    741         if ((err = snd_pcm_hw_constraint_list(runtime, 0, SNDRV_PCM_HW_PARAM_RATE,
    742                                               &hw_constraints_rates)) < 0)
     742        err = snd_pcm_hw_constraint_list(runtime, 0, SNDRV_PCM_HW_PARAM_RATE,
     743                                         &hw_constraints_rates);
     744        if (err < 0)
    743745                return err;
    744746
    745747        /* we may remove following constaint when we modify table entries
    746748           in interrupt */
    747         if ((err = snd_pcm_hw_constraint_integer(runtime, SNDRV_PCM_HW_PARAM_PERIODS)) < 0)
     749        err = snd_pcm_hw_constraint_integer(runtime, SNDRV_PCM_HW_PARAM_PERIODS);
     750        if (err < 0)
    748751                return err;
    749752
     
    879882        };
    880883
    881         if ((err = snd_ac97_bus(chip->card, 0, &ops, chip, &chip->ac97_bus)) < 0)
     884        err = snd_ac97_bus(chip->card, 0, &ops, chip, &chip->ac97_bus);
     885        if (err < 0)
    882886                return err;
    883887        chip->ac97_bus->private_free = snd_via82xx_mixer_free_ac97_bus;
     
    891895        ac97.num = chip->ac97_secondary;
    892896
    893         if ((err = snd_ac97_mixer(chip->ac97_bus, &ac97, &chip->ac97)) < 0)
     897        err = snd_ac97_mixer(chip->ac97_bus, &ac97, &chip->ac97);
     898        if (err < 0)
    894899                return err;
    895900
     
    972977        } while (time_before(jiffies, end_time));
    973978
    974         if ((val = snd_via82xx_codec_xread(chip)) & VIA_REG_AC97_BUSY)
     979        val = snd_via82xx_codec_xread(chip);
     980        if (val & VIA_REG_AC97_BUSY)
    975981                dev_err(chip->card->dev,
    976982                        "AC'97 codec is not ready [0x%x]\n", val);
     
    984990                                 (VIA_REG_AC97_CODEC_ID_SECONDARY << VIA_REG_AC97_CODEC_ID_SHIFT));
    985991        do {
    986                 if ((val = snd_via82xx_codec_xread(chip)) & VIA_REG_AC97_SECONDARY_VALID) {
     992                val = snd_via82xx_codec_xread(chip);
     993                if (val & VIA_REG_AC97_SECONDARY_VALID) {
    987994                        chip->ac97_secondary = 1;
    988995                        goto __ac97_ok2;
     
    10801087        };
    10811088
    1082         if ((err = pci_enable_device(pci)) < 0)
     1089        err = pci_enable_device(pci);
     1090        if (err < 0)
    10831091                return err;
    10841092
    1085         if ((chip = kzalloc(sizeof(*chip), GFP_KERNEL)) == NULL) {
     1093        chip = kzalloc(sizeof(*chip), GFP_KERNEL);
     1094        if (!chip) {
    10861095                pci_disable_device(pci);
    10871096                return -ENOMEM;
     
    10931102        chip->irq = -1;
    10941103
    1095         if ((err = pci_request_regions(pci, card->driver)) < 0) {
     1104        err = pci_request_regions(pci, card->driver);
     1105        if (err < 0) {
    10961106                kfree(chip);
    10971107                pci_disable_device(pci);
     
    11101120                chip->ac97_clock = ac97_clock;
    11111121
    1112         if ((err = snd_via82xx_chip_init(chip)) < 0) {
     1122        err = snd_via82xx_chip_init(chip);
     1123        if (err < 0) {
    11131124                snd_via82xx_free(chip);
    11141125                return err;
    11151126        }
    11161127
    1117         if ((err = snd_device_new(card, SNDRV_DEV_LOWLEVEL, chip, &ops)) < 0) {
     1128        err = snd_device_new(card, SNDRV_DEV_LOWLEVEL, chip, &ops);
     1129        if (err < 0) {
    11181130                snd_via82xx_free(chip);
    11191131                return err;
     
    11551167        }
    11561168               
    1157         if ((err = snd_via82xx_create(card, pci, chip_type, pci->revision,
    1158                                       ac97_clock, &chip)) < 0)
     1169        err = snd_via82xx_create(card, pci, chip_type, pci->revision,
     1170                                 ac97_clock, &chip);
     1171        if (err < 0)
    11591172                goto __error;
    11601173        card->private_data = chip;
    1161         if ((err = snd_via82xx_mixer_new(chip)) < 0)
     1174        err = snd_via82xx_mixer_new(chip);
     1175        if (err < 0)
    11621176                goto __error;
    11631177
    1164         if ((err = snd_via686_pcm_new(chip)) < 0 )
     1178        err = snd_via686_pcm_new(chip);
     1179        if (err < 0)
    11651180                goto __error;
    11661181
     
    11741189        snd_via82xx_proc_init(chip);
    11751190
    1176         if ((err = snd_card_register(card)) < 0) {
     1191        err = snd_card_register(card);
     1192        if (err < 0) {
    11771193                snd_card_free(card);
    11781194                return err;
  • GPL/trunk/alsa-kernel/pci/ymfpci/ymfpci.c

    r695 r703  
    7777                if (io_port == 1) {
    7878                        /* auto-detect */
    79                         if (!(io_port = pci_resource_start(chip->pci, 2)))
     79                        io_port = pci_resource_start(chip->pci, 2);
     80                        if (!io_port)
    8081                                return -ENODEV;
    8182                }
     
    8687                                if (io_port == 0x203)
    8788                                        continue;
    88                                 if ((r = request_region(io_port, 1, "YMFPCI gameport")) != NULL)
     89                                r = request_region(io_port, 1, "YMFPCI gameport");
     90                                if (r)
    8991                                        break;
    9092                        }
     
    107109        }
    108110
    109         if (!r && !(r = request_region(io_port, 1, "YMFPCI gameport"))) {
    110                 dev_err(chip->card->dev,
    111                         "joystick port %#x is in use.\n", io_port);
    112                 return -EBUSY;
     111        if (!r) {
     112                r = request_region(io_port, 1, "YMFPCI gameport");
     113                if (!r) {
     114                        dev_err(chip->card->dev,
     115                                "joystick port %#x is in use.\n", io_port);
     116                        return -EBUSY;
     117                }
    113118        }
    114119
     
    198203                        fm_port[dev] = pci_resource_start(pci, 1);
    199204                }
    200                 if (fm_port[dev] > 0 &&
    201                     (fm_res = request_region(fm_port[dev], 4, "YMFPCI OPL3")) != NULL) {
     205                if (fm_port[dev] > 0)
     206                        fm_res = request_region(fm_port[dev], 4, "YMFPCI OPL3");
     207                if (fm_res) {
    202208                        legacy_ctrl |= YMFPCI_LEGACY_FMEN;
    203209                        pci_write_config_word(pci, PCIR_DSXG_FMBASE, fm_port[dev]);
     
    207213                        mpu_port[dev] = pci_resource_start(pci, 1) + 0x20;
    208214                }
    209                 if (mpu_port[dev] > 0 &&
    210                     (mpu_res = request_region(mpu_port[dev], 2, "YMFPCI MPU401")) != NULL) {
     215                if (mpu_port[dev] > 0)
     216                        mpu_res = request_region(mpu_port[dev], 2, "YMFPCI MPU401");
     217                if (mpu_res) {
    211218                        legacy_ctrl |= YMFPCI_LEGACY_MEN;
    212219                        pci_write_config_word(pci, PCIR_DSXG_MPU401BASE, mpu_port[dev]);
     
    220227                default: fm_port[dev] = 0; break;
    221228                }
    222                 if (fm_port[dev] > 0 &&
    223                     (fm_res = request_region(fm_port[dev], 4, "YMFPCI OPL3")) != NULL) {
     229                if (fm_port[dev] > 0)
     230                        fm_res = request_region(fm_port[dev], 4, "YMFPCI OPL3");
     231                if (fm_res) {
    224232                        legacy_ctrl |= YMFPCI_LEGACY_FMEN;
    225233                } else {
     
    234242                default: mpu_port[dev] = 0; break;
    235243                }
    236                 if (mpu_port[dev] > 0 &&
    237                     (mpu_res = request_region(mpu_port[dev], 2, "YMFPCI MPU401")) != NULL) {
     244                if (mpu_port[dev] > 0)
     245                        mpu_res = request_region(mpu_port[dev], 2, "YMFPCI MPU401");
     246                if (mpu_res) {
    238247                        legacy_ctrl |= YMFPCI_LEGACY_MEN;
    239248                } else {
     
    249258        pci_write_config_word(pci, PCIR_DSXG_LEGACY, legacy_ctrl);
    250259        pci_write_config_word(pci, PCIR_DSXG_ELEGACY, legacy_ctrl2);
    251         if ((err = snd_ymfpci_create(card, pci,
    252                                      old_legacy_ctrl,
    253                                      &chip)) < 0) {
     260        err = snd_ymfpci_create(card, pci, old_legacy_ctrl, &chip);
     261        if (err  < 0) {
    254262                release_and_free_resource(mpu_res);
    255263                release_and_free_resource(fm_res);
     
    292300
    293301        if (chip->mpu_res) {
    294                 if ((err = snd_mpu401_uart_new(card, 0, MPU401_HW_YMFPCI,
    295                                                mpu_port[dev],
    296                                                MPU401_INFO_INTEGRATED |
    297                                                MPU401_INFO_IRQ_HOOK,
    298                                                -1, &chip->rawmidi)) < 0) {
     302                err = snd_mpu401_uart_new(card, 0, MPU401_HW_YMFPCI,
     303                                          mpu_port[dev],
     304                                          MPU401_INFO_INTEGRATED |
     305                                          MPU401_INFO_IRQ_HOOK,
     306                                          -1, &chip->rawmidi);
     307                if (err < 0) {
    299308                        dev_warn(card->dev,
    300309                                 "cannot initialize MPU401 at 0x%lx, skipping...\n",
     
    305314        }
    306315        if (chip->fm_res) {
    307                 if ((err = snd_opl3_create(card,
    308                                            fm_port[dev],
    309                                            fm_port[dev] + 2,
    310                                            OPL3_HW_OPL3, 1, &opl3)) < 0) {
     316                err = snd_opl3_create(card,
     317                                      fm_port[dev],
     318                                      fm_port[dev] + 2,
     319                                      OPL3_HW_OPL3, 1, &opl3);
     320                if (err < 0) {
    311321                        dev_warn(card->dev,
    312322                                 "cannot initialize FM OPL3 at 0x%lx, skipping...\n",
     
    314324                        legacy_ctrl &= ~YMFPCI_LEGACY_FMEN;
    315325                        pci_write_config_word(pci, PCIR_DSXG_LEGACY, legacy_ctrl);
    316                 } else if ((err = snd_opl3_hwdep_new(opl3, 0, 1, NULL)) < 0) {
    317                         dev_err(card->dev, "cannot create opl3 hwdep\n");
    318                         goto free_card;
     326                } else {
     327                        err = snd_opl3_hwdep_new(opl3, 0, 1, NULL);
     328                        if (err < 0) {
     329                                dev_err(card->dev, "cannot create opl3 hwdep\n");
     330                                goto free_card;
     331                        }
    319332                }
    320333        }
  • GPL/trunk/alsa-kernel/pci/ymfpci/ymfpci_main.c

    r679 r703  
    297297        u32 pos, delta;
    298298       
    299         if ((ypcm = voice->ypcm) == NULL)
     299        ypcm = voice->ypcm;
     300        if (!ypcm)
    300301                return;
    301302        if (ypcm->substream == NULL)
     
    633634        int err;
    634635
    635         if ((err = snd_ymfpci_pcm_voice_alloc(ypcm, params_channels(hw_params))) < 0)
     636        err = snd_ymfpci_pcm_voice_alloc(ypcm, params_channels(hw_params));
     637        if (err < 0)
    636638                return err;
    637639        return 0;
     
    937939        int err;
    938940       
    939         if ((err = snd_ymfpci_playback_open_1(substream)) < 0)
     941        err = snd_ymfpci_playback_open_1(substream);
     942        if (err < 0)
    940943                return err;
    941944        ypcm = runtime->private_data;
     
    959962        int err;
    960963       
    961         if ((err = snd_ymfpci_playback_open_1(substream)) < 0)
     964        err = snd_ymfpci_playback_open_1(substream);
     965        if (err < 0)
    962966                return err;
    963967        ypcm = runtime->private_data;
     
    987991        int err;
    988992       
    989         if ((err = snd_ymfpci_playback_open_1(substream)) < 0)
     993        err = snd_ymfpci_playback_open_1(substream);
     994        if (err < 0)
    990995                return err;
    991996        ypcm = runtime->private_data;
     
    11291134        int err;
    11301135
    1131         if ((err = snd_pcm_new(chip->card, "YMFPCI", device, 32, 1, &pcm)) < 0)
     1136        err = snd_pcm_new(chip->card, "YMFPCI", device, 32, 1, &pcm);
     1137        if (err < 0)
    11321138                return err;
    11331139        pcm->private_data = chip;
     
    11621168        int err;
    11631169
    1164         if ((err = snd_pcm_new(chip->card, "YMFPCI - PCM2", device, 0, 1, &pcm)) < 0)
     1170        err = snd_pcm_new(chip->card, "YMFPCI - PCM2", device, 0, 1, &pcm);
     1171        if (err < 0)
    11651172                return err;
    11661173        pcm->private_data = chip;
     
    11951202        int err;
    11961203
    1197         if ((err = snd_pcm_new(chip->card, "YMFPCI - IEC958", device, 1, 0, &pcm)) < 0)
     1204        err = snd_pcm_new(chip->card, "YMFPCI - IEC958", device, 1, 0, &pcm);
     1205        if (err < 0)
    11981206                return err;
    11991207        pcm->private_data = chip;
     
    12351243        int err;
    12361244
    1237         if ((err = snd_pcm_new(chip->card, "YMFPCI - Rear", device, 1, 0, &pcm)) < 0)
     1245        err = snd_pcm_new(chip->card, "YMFPCI - Rear", device, 1, 0, &pcm);
     1246        if (err < 0)
    12381247                return err;
    12391248        pcm->private_data = chip;
     
    17901799        };
    17911800
    1792         if ((err = snd_ac97_bus(chip->card, 0, &ops, chip, &chip->ac97_bus)) < 0)
     1801        err = snd_ac97_bus(chip->card, 0, &ops, chip, &chip->ac97_bus);
     1802        if (err < 0)
    17931803                return err;
    17941804        chip->ac97_bus->private_free = snd_ymfpci_mixer_free_ac97_bus;
     
    17981808        ac97.private_data = chip;
    17991809        ac97.private_free = snd_ymfpci_mixer_free_ac97;
    1800         if ((err = snd_ac97_mixer(chip->ac97_bus, &ac97, &chip->ac97)) < 0)
     1810        err = snd_ac97_mixer(chip->ac97_bus, &ac97, &chip->ac97);
     1811        if (err < 0)
    18011812                return err;
    18021813
     
    18061817
    18071818        for (idx = 0; idx < ARRAY_SIZE(snd_ymfpci_controls); idx++) {
    1808                 if ((err = snd_ctl_add(chip->card, snd_ctl_new1(&snd_ymfpci_controls[idx], chip))) < 0)
     1819                err = snd_ctl_add(chip->card, snd_ctl_new1(&snd_ymfpci_controls[idx], chip));
     1820                if (err < 0)
    18091821                        return err;
    18101822        }
     
    18191831        if (snd_BUG_ON(!chip->pcm_spdif))
    18201832                return -ENXIO;
    1821         if ((err = snd_ctl_add(chip->card, kctl = snd_ctl_new1(&snd_ymfpci_spdif_default, chip))) < 0)
     1833        kctl = snd_ctl_new1(&snd_ymfpci_spdif_default, chip);
     1834        err = snd_ctl_add(chip->card, kctl);
     1835        if (err < 0)
    18221836                return err;
    18231837        kctl->id.device = chip->pcm_spdif->device;
    1824         if ((err = snd_ctl_add(chip->card, kctl = snd_ctl_new1(&snd_ymfpci_spdif_mask, chip))) < 0)
     1838        kctl = snd_ctl_new1(&snd_ymfpci_spdif_mask, chip);
     1839        err = snd_ctl_add(chip->card, kctl);
     1840        if (err < 0)
    18251841                return err;
    18261842        kctl->id.device = chip->pcm_spdif->device;
    1827         if ((err = snd_ctl_add(chip->card, kctl = snd_ctl_new1(&snd_ymfpci_spdif_stream, chip))) < 0)
     1843        kctl = snd_ctl_new1(&snd_ymfpci_spdif_stream, chip);
     1844        err = snd_ctl_add(chip->card, kctl);
     1845        if (err < 0)
    18281846                return err;
    18291847        kctl->id.device = chip->pcm_spdif->device;
     
    18311849
    18321850        /* direct recording source */
    1833         if (chip->device_id == PCI_DEVICE_ID_YAMAHA_754 &&
    1834             (err = snd_ctl_add(chip->card, kctl = snd_ctl_new1(&snd_ymfpci_drec_source, chip))) < 0)
    1835                 return err;
     1851        if (chip->device_id == PCI_DEVICE_ID_YAMAHA_754) {
     1852                kctl = snd_ctl_new1(&snd_ymfpci_drec_source, chip);
     1853                err = snd_ctl_add(chip->card, kctl);
     1854                if (err < 0)
     1855                        return err;
     1856        }
    18361857
    18371858        /*
     
    18391860         */
    18401861        if (rear_switch) {
    1841                 if ((err = snd_ctl_add(chip->card, snd_ctl_new1(&snd_ymfpci_rear_shared, chip))) < 0)
     1862                err = snd_ctl_add(chip->card, snd_ctl_new1(&snd_ymfpci_rear_shared, chip));
     1863                if (err < 0)
    18421864                        return err;
    18431865        }
     
    18521874                kctl->id.subdevice = idx;
    18531875                kctl->private_value = (unsigned long)substream;
    1854                 if ((err = snd_ctl_add(chip->card, kctl)) < 0)
     1876                err = snd_ctl_add(chip->card, kctl);
     1877                if (err < 0)
    18551878                        return err;
    18561879                chip->pcm_mixer[idx].left = 0x8000;
     
    19331956        tid.device = device;
    19341957        tid.subdevice = 0;
    1935         if ((err = snd_timer_new(chip->card, "YMFPCI", &tid, &timer)) >= 0) {
     1958        err = snd_timer_new(chip->card, "YMFPCI", &tid, &timer);
     1959        if (err >= 0) {
    19361960                strcpy(timer->name, "YMFPCI timer");
    19371961                timer->private_data = chip;
     
    23392363
    23402364        /* enable PCI device */
    2341         if ((err = pci_enable_device(pci)) < 0)
     2365        err = pci_enable_device(pci);
     2366        if (err < 0)
    23422367                return err;
    23432368
     
    23622387        chip->src441_used = -1;
    23632388
    2364         if ((chip->res_reg_area = request_mem_region(chip->reg_area_phys, 0x8000, "YMFPCI")) == NULL) {
     2389        chip->res_reg_area = request_mem_region(chip->reg_area_phys, 0x8000, "YMFPCI");
     2390        if (!chip->res_reg_area) {
    23652391                dev_err(chip->card->dev,
    23662392                        "unable to grab memory region 0x%lx-0x%lx\n",
Note: See TracChangeset for help on using the changeset viewer.