network/sr-iov: ignore -EINVAL in reading dev_port sysfs attribute

Fixes #27369.
This commit is contained in:
Yu Watanabe
2023-09-08 00:54:08 +09:00
parent c63db5420c
commit 4b12a8dd33

View File

@@ -209,7 +209,11 @@ static int link_set_sr_iov_phys_port(Link *link) {
if (!link->dev)
return -ENODEV;
/* This may return -EINVAL or -ENODEV, instead of -ENOENT, if the device has been removed or is being
* removed. Let's map -EINVAL to -ENODEV, as the caller will ignore -ENODEV. */
r = sd_device_get_sysattr_value(link->dev, "dev_port", &dev_port);
if (r == -EINVAL)
return -ENODEV;
if (r < 0)
return r;
@@ -242,6 +246,8 @@ static int link_set_sr_iov_virt_ports(Link *link) {
return -ENODEV;
r = sd_device_get_sysattr_value(link->dev, "dev_port", &dev_port);
if (r == -EINVAL)
return -ENODEV;
if (r < 0)
return r;