Skip to content

Commit b4a9b52

Browse files
committed
mi-mctp: suppress error on scanning endpoints we already have
It's not an error to have an endpoint in our list prior to scanning; just suppress the duplicate and keep going. Signed-off-by: Jeremy Kerr <[email protected]>
1 parent 775dd99 commit b4a9b52

1 file changed

Lines changed: 4 additions & 5 deletions

File tree

src/nvme/mi-mctp.c

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -436,20 +436,19 @@ static void _dbus_err(nvme_root_t root, int rc, int line) {
436436

437437
#define dbus_err(r, rc) _dbus_err(r, rc, __LINE__)
438438

439-
/* Returns -EEXISTS on duplicate */
440439
static int nvme_mi_mctp_add(nvme_root_t root, unsigned int netid, __u8 eid)
441440
{
442441
nvme_mi_ep_t ep = NULL;
443442

444-
/* ensure we don't already have an endpoint with the same net/eid */
443+
/* ensure we don't already have an endpoint with the same net/eid. if
444+
* we do, just skip, no need to re-add. */
445445
list_for_each(&root->endpoints, ep, root_entry) {
446446
if (ep->transport != &nvme_mi_transport_mctp) {
447447
continue;
448448
}
449449
const struct nvme_mi_transport_mctp *t = ep->transport_data;
450-
if (t->eid == eid && t->net == netid) {
451-
return -EEXIST;
452-
}
450+
if (t->eid == eid && t->net == netid)
451+
return 0;
453452
}
454453

455454
ep = nvme_mi_open_mctp(root, netid, eid);

0 commit comments

Comments
 (0)