Changeset 743f2cdd in mainline


Ignore:
Timestamp:
2024-06-20T07:24:07Z (5 weeks ago)
Author:
Jiri Svoboda <jiri@…>
Branches:
master
Children:
ec50d65e
Parents:
7cec216
git-author:
Jiri Svoboda <jiri@…> (2024-06-19 17:23:44)
git-committer:
Jiri Svoboda <jiri@…> (2024-06-20 07:24:07)
Message:

Fix error path when adding ATA devices

This would errorneously cause us to add two devices when there were
no devices on the channel.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/ata/src/ata.c

    r7cec216 r743f2cdd  
    179179        int n_disks;
    180180        bool irq_inited = false;
     181        bool dev_added[MAX_DEVICES];
     182
     183        for (i = 0; i < MAX_DEVICES; i++)
     184                dev_added[i] = false;
    181185
    182186        ata_msg_debug(chan, "ata_channel_initialize()");
     
    212216                        goto error;
    213217                }
     218                dev_added[i] = true;
    214219                ++n_disks;
    215220        }
     
    224229error:
    225230        for (i = 0; i < MAX_DEVICES; i++) {
    226                 if (ata_device_add(&chan->device[i]) != EOK) {
    227                         ata_msg_error(chan, "Unable to remove device %d.", i);
     231                if (dev_added[i]) {
     232                        rc = ata_device_remove(&chan->device[i]);
     233                        if (rc != EOK) {
     234                                ata_msg_error(chan,
     235                                    "Unable to remove device %d.", i);
     236                        }
    228237                }
    229238        }
Note: See TracChangeset for help on using the changeset viewer.