| .. | .. |
|---|
| 292 | 292 | struct snd_ymfpci_pcm *ypcm; |
|---|
| 293 | 293 | u32 pos, delta; |
|---|
| 294 | 294 | |
|---|
| 295 | | - if ((ypcm = voice->ypcm) == NULL) |
|---|
| 295 | + ypcm = voice->ypcm; |
|---|
| 296 | + if (!ypcm) |
|---|
| 296 | 297 | return; |
|---|
| 297 | 298 | if (ypcm->substream == NULL) |
|---|
| 298 | 299 | return; |
|---|
| .. | .. |
|---|
| 628 | 629 | struct snd_ymfpci_pcm *ypcm = runtime->private_data; |
|---|
| 629 | 630 | int err; |
|---|
| 630 | 631 | |
|---|
| 631 | | - if ((err = snd_ymfpci_pcm_voice_alloc(ypcm, params_channels(hw_params))) < 0) |
|---|
| 632 | + err = snd_ymfpci_pcm_voice_alloc(ypcm, params_channels(hw_params)); |
|---|
| 633 | + if (err < 0) |
|---|
| 632 | 634 | return err; |
|---|
| 633 | 635 | return 0; |
|---|
| 634 | 636 | } |
|---|
| .. | .. |
|---|
| 932 | 934 | struct snd_ymfpci_pcm *ypcm; |
|---|
| 933 | 935 | int err; |
|---|
| 934 | 936 | |
|---|
| 935 | | - if ((err = snd_ymfpci_playback_open_1(substream)) < 0) |
|---|
| 937 | + err = snd_ymfpci_playback_open_1(substream); |
|---|
| 938 | + if (err < 0) |
|---|
| 936 | 939 | return err; |
|---|
| 937 | 940 | ypcm = runtime->private_data; |
|---|
| 938 | 941 | ypcm->output_front = 1; |
|---|
| .. | .. |
|---|
| 954 | 957 | struct snd_ymfpci_pcm *ypcm; |
|---|
| 955 | 958 | int err; |
|---|
| 956 | 959 | |
|---|
| 957 | | - if ((err = snd_ymfpci_playback_open_1(substream)) < 0) |
|---|
| 960 | + err = snd_ymfpci_playback_open_1(substream); |
|---|
| 961 | + if (err < 0) |
|---|
| 958 | 962 | return err; |
|---|
| 959 | 963 | ypcm = runtime->private_data; |
|---|
| 960 | 964 | ypcm->output_front = 0; |
|---|
| .. | .. |
|---|
| 982 | 986 | struct snd_ymfpci_pcm *ypcm; |
|---|
| 983 | 987 | int err; |
|---|
| 984 | 988 | |
|---|
| 985 | | - if ((err = snd_ymfpci_playback_open_1(substream)) < 0) |
|---|
| 989 | + err = snd_ymfpci_playback_open_1(substream); |
|---|
| 990 | + if (err < 0) |
|---|
| 986 | 991 | return err; |
|---|
| 987 | 992 | ypcm = runtime->private_data; |
|---|
| 988 | 993 | ypcm->output_front = 0; |
|---|
| .. | .. |
|---|
| 1124 | 1129 | struct snd_pcm *pcm; |
|---|
| 1125 | 1130 | int err; |
|---|
| 1126 | 1131 | |
|---|
| 1127 | | - if ((err = snd_pcm_new(chip->card, "YMFPCI", device, 32, 1, &pcm)) < 0) |
|---|
| 1132 | + err = snd_pcm_new(chip->card, "YMFPCI", device, 32, 1, &pcm); |
|---|
| 1133 | + if (err < 0) |
|---|
| 1128 | 1134 | return err; |
|---|
| 1129 | 1135 | pcm->private_data = chip; |
|---|
| 1130 | 1136 | |
|---|
| .. | .. |
|---|
| 1157 | 1163 | struct snd_pcm *pcm; |
|---|
| 1158 | 1164 | int err; |
|---|
| 1159 | 1165 | |
|---|
| 1160 | | - if ((err = snd_pcm_new(chip->card, "YMFPCI - PCM2", device, 0, 1, &pcm)) < 0) |
|---|
| 1166 | + err = snd_pcm_new(chip->card, "YMFPCI - PCM2", device, 0, 1, &pcm); |
|---|
| 1167 | + if (err < 0) |
|---|
| 1161 | 1168 | return err; |
|---|
| 1162 | 1169 | pcm->private_data = chip; |
|---|
| 1163 | 1170 | |
|---|
| .. | .. |
|---|
| 1190 | 1197 | struct snd_pcm *pcm; |
|---|
| 1191 | 1198 | int err; |
|---|
| 1192 | 1199 | |
|---|
| 1193 | | - if ((err = snd_pcm_new(chip->card, "YMFPCI - IEC958", device, 1, 0, &pcm)) < 0) |
|---|
| 1200 | + err = snd_pcm_new(chip->card, "YMFPCI - IEC958", device, 1, 0, &pcm); |
|---|
| 1201 | + if (err < 0) |
|---|
| 1194 | 1202 | return err; |
|---|
| 1195 | 1203 | pcm->private_data = chip; |
|---|
| 1196 | 1204 | |
|---|
| .. | .. |
|---|
| 1230 | 1238 | struct snd_pcm *pcm; |
|---|
| 1231 | 1239 | int err; |
|---|
| 1232 | 1240 | |
|---|
| 1233 | | - if ((err = snd_pcm_new(chip->card, "YMFPCI - Rear", device, 1, 0, &pcm)) < 0) |
|---|
| 1241 | + err = snd_pcm_new(chip->card, "YMFPCI - Rear", device, 1, 0, &pcm); |
|---|
| 1242 | + if (err < 0) |
|---|
| 1234 | 1243 | return err; |
|---|
| 1235 | 1244 | pcm->private_data = chip; |
|---|
| 1236 | 1245 | |
|---|
| .. | .. |
|---|
| 1785 | 1794 | .read = snd_ymfpci_codec_read, |
|---|
| 1786 | 1795 | }; |
|---|
| 1787 | 1796 | |
|---|
| 1788 | | - if ((err = snd_ac97_bus(chip->card, 0, &ops, chip, &chip->ac97_bus)) < 0) |
|---|
| 1797 | + err = snd_ac97_bus(chip->card, 0, &ops, chip, &chip->ac97_bus); |
|---|
| 1798 | + if (err < 0) |
|---|
| 1789 | 1799 | return err; |
|---|
| 1790 | 1800 | chip->ac97_bus->private_free = snd_ymfpci_mixer_free_ac97_bus; |
|---|
| 1791 | 1801 | chip->ac97_bus->no_vra = 1; /* YMFPCI doesn't need VRA */ |
|---|
| .. | .. |
|---|
| 1793 | 1803 | memset(&ac97, 0, sizeof(ac97)); |
|---|
| 1794 | 1804 | ac97.private_data = chip; |
|---|
| 1795 | 1805 | ac97.private_free = snd_ymfpci_mixer_free_ac97; |
|---|
| 1796 | | - if ((err = snd_ac97_mixer(chip->ac97_bus, &ac97, &chip->ac97)) < 0) |
|---|
| 1806 | + err = snd_ac97_mixer(chip->ac97_bus, &ac97, &chip->ac97); |
|---|
| 1807 | + if (err < 0) |
|---|
| 1797 | 1808 | return err; |
|---|
| 1798 | 1809 | |
|---|
| 1799 | 1810 | /* to be sure */ |
|---|
| .. | .. |
|---|
| 1801 | 1812 | AC97_EA_VRA|AC97_EA_VRM, 0); |
|---|
| 1802 | 1813 | |
|---|
| 1803 | 1814 | for (idx = 0; idx < ARRAY_SIZE(snd_ymfpci_controls); idx++) { |
|---|
| 1804 | | - if ((err = snd_ctl_add(chip->card, snd_ctl_new1(&snd_ymfpci_controls[idx], chip))) < 0) |
|---|
| 1815 | + err = snd_ctl_add(chip->card, snd_ctl_new1(&snd_ymfpci_controls[idx], chip)); |
|---|
| 1816 | + if (err < 0) |
|---|
| 1805 | 1817 | return err; |
|---|
| 1806 | 1818 | } |
|---|
| 1807 | 1819 | if (chip->ac97->ext_id & AC97_EI_SDAC) { |
|---|
| .. | .. |
|---|
| 1814 | 1826 | /* add S/PDIF control */ |
|---|
| 1815 | 1827 | if (snd_BUG_ON(!chip->pcm_spdif)) |
|---|
| 1816 | 1828 | return -ENXIO; |
|---|
| 1817 | | - if ((err = snd_ctl_add(chip->card, kctl = snd_ctl_new1(&snd_ymfpci_spdif_default, chip))) < 0) |
|---|
| 1829 | + kctl = snd_ctl_new1(&snd_ymfpci_spdif_default, chip); |
|---|
| 1830 | + err = snd_ctl_add(chip->card, kctl); |
|---|
| 1831 | + if (err < 0) |
|---|
| 1818 | 1832 | return err; |
|---|
| 1819 | 1833 | kctl->id.device = chip->pcm_spdif->device; |
|---|
| 1820 | | - if ((err = snd_ctl_add(chip->card, kctl = snd_ctl_new1(&snd_ymfpci_spdif_mask, chip))) < 0) |
|---|
| 1834 | + kctl = snd_ctl_new1(&snd_ymfpci_spdif_mask, chip); |
|---|
| 1835 | + err = snd_ctl_add(chip->card, kctl); |
|---|
| 1836 | + if (err < 0) |
|---|
| 1821 | 1837 | return err; |
|---|
| 1822 | 1838 | kctl->id.device = chip->pcm_spdif->device; |
|---|
| 1823 | | - if ((err = snd_ctl_add(chip->card, kctl = snd_ctl_new1(&snd_ymfpci_spdif_stream, chip))) < 0) |
|---|
| 1839 | + kctl = snd_ctl_new1(&snd_ymfpci_spdif_stream, chip); |
|---|
| 1840 | + err = snd_ctl_add(chip->card, kctl); |
|---|
| 1841 | + if (err < 0) |
|---|
| 1824 | 1842 | return err; |
|---|
| 1825 | 1843 | kctl->id.device = chip->pcm_spdif->device; |
|---|
| 1826 | 1844 | chip->spdif_pcm_ctl = kctl; |
|---|
| 1827 | 1845 | |
|---|
| 1828 | 1846 | /* direct recording source */ |
|---|
| 1829 | | - if (chip->device_id == PCI_DEVICE_ID_YAMAHA_754 && |
|---|
| 1830 | | - (err = snd_ctl_add(chip->card, kctl = snd_ctl_new1(&snd_ymfpci_drec_source, chip))) < 0) |
|---|
| 1831 | | - return err; |
|---|
| 1847 | + if (chip->device_id == PCI_DEVICE_ID_YAMAHA_754) { |
|---|
| 1848 | + kctl = snd_ctl_new1(&snd_ymfpci_drec_source, chip); |
|---|
| 1849 | + err = snd_ctl_add(chip->card, kctl); |
|---|
| 1850 | + if (err < 0) |
|---|
| 1851 | + return err; |
|---|
| 1852 | + } |
|---|
| 1832 | 1853 | |
|---|
| 1833 | 1854 | /* |
|---|
| 1834 | 1855 | * shared rear/line-in |
|---|
| 1835 | 1856 | */ |
|---|
| 1836 | 1857 | if (rear_switch) { |
|---|
| 1837 | | - if ((err = snd_ctl_add(chip->card, snd_ctl_new1(&snd_ymfpci_rear_shared, chip))) < 0) |
|---|
| 1858 | + err = snd_ctl_add(chip->card, snd_ctl_new1(&snd_ymfpci_rear_shared, chip)); |
|---|
| 1859 | + if (err < 0) |
|---|
| 1838 | 1860 | return err; |
|---|
| 1839 | 1861 | } |
|---|
| 1840 | 1862 | |
|---|
| .. | .. |
|---|
| 1847 | 1869 | kctl->id.device = chip->pcm->device; |
|---|
| 1848 | 1870 | kctl->id.subdevice = idx; |
|---|
| 1849 | 1871 | kctl->private_value = (unsigned long)substream; |
|---|
| 1850 | | - if ((err = snd_ctl_add(chip->card, kctl)) < 0) |
|---|
| 1872 | + err = snd_ctl_add(chip->card, kctl); |
|---|
| 1873 | + if (err < 0) |
|---|
| 1851 | 1874 | return err; |
|---|
| 1852 | 1875 | chip->pcm_mixer[idx].left = 0x8000; |
|---|
| 1853 | 1876 | chip->pcm_mixer[idx].right = 0x8000; |
|---|
| .. | .. |
|---|
| 1928 | 1951 | tid.card = chip->card->number; |
|---|
| 1929 | 1952 | tid.device = device; |
|---|
| 1930 | 1953 | tid.subdevice = 0; |
|---|
| 1931 | | - if ((err = snd_timer_new(chip->card, "YMFPCI", &tid, &timer)) >= 0) { |
|---|
| 1954 | + err = snd_timer_new(chip->card, "YMFPCI", &tid, &timer); |
|---|
| 1955 | + if (err >= 0) { |
|---|
| 1932 | 1956 | strcpy(timer->name, "YMFPCI timer"); |
|---|
| 1933 | 1957 | timer->private_data = chip; |
|---|
| 1934 | 1958 | timer->hw = snd_ymfpci_timer_hw; |
|---|
| .. | .. |
|---|
| 2140 | 2164 | chip->work_base = ptr; |
|---|
| 2141 | 2165 | chip->work_base_addr = ptr_addr; |
|---|
| 2142 | 2166 | |
|---|
| 2143 | | - snd_BUG_ON(ptr + chip->work_size != |
|---|
| 2167 | + snd_BUG_ON(ptr + PAGE_ALIGN(chip->work_size) != |
|---|
| 2144 | 2168 | chip->work_ptr.area + chip->work_ptr.bytes); |
|---|
| 2145 | 2169 | |
|---|
| 2146 | 2170 | snd_ymfpci_writel(chip, YDSXGR_PLAYCTRLBASE, chip->bank_base_playback_addr); |
|---|
| .. | .. |
|---|
| 2334 | 2358 | *rchip = NULL; |
|---|
| 2335 | 2359 | |
|---|
| 2336 | 2360 | /* enable PCI device */ |
|---|
| 2337 | | - if ((err = pci_enable_device(pci)) < 0) |
|---|
| 2361 | + err = pci_enable_device(pci); |
|---|
| 2362 | + if (err < 0) |
|---|
| 2338 | 2363 | return err; |
|---|
| 2339 | 2364 | |
|---|
| 2340 | 2365 | chip = kzalloc(sizeof(*chip), GFP_KERNEL); |
|---|
| .. | .. |
|---|
| 2357 | 2382 | pci_set_master(pci); |
|---|
| 2358 | 2383 | chip->src441_used = -1; |
|---|
| 2359 | 2384 | |
|---|
| 2360 | | - if ((chip->res_reg_area = request_mem_region(chip->reg_area_phys, 0x8000, "YMFPCI")) == NULL) { |
|---|
| 2385 | + chip->res_reg_area = request_mem_region(chip->reg_area_phys, 0x8000, "YMFPCI"); |
|---|
| 2386 | + if (!chip->res_reg_area) { |
|---|
| 2361 | 2387 | dev_err(chip->card->dev, |
|---|
| 2362 | 2388 | "unable to grab memory region 0x%lx-0x%lx\n", |
|---|
| 2363 | 2389 | chip->reg_area_phys, chip->reg_area_phys + 0x8000 - 1); |
|---|