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:
2 edited

Legend:

Unmodified
Added
Removed
  • GPL/trunk

  • 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        }
Note: See TracChangeset for help on using the changeset viewer.