@@ -81,6 +81,7 @@ static int rxe_query_port(struct ib_device *dev,
struct rxe_dev *rxe = to_rdev(dev);
struct rxe_port *port;
u32 speed;
+ int rc = -EINVAL;
if (unlikely(port_num != 1)) {
pr_warn("invalid port_number %d\n", port_num);
@@ -96,14 +97,15 @@ static int rxe_query_port(struct ib_device *dev,
if (rxe->ndev->ethtool_ops->get_link_ksettings) {
struct ethtool_link_ksettings ks;
- rxe->ndev->ethtool_ops->get_link_ksettings(rxe->ndev, &ks);
+ rc = rxe->ndev->ethtool_ops->get_link_ksettings(rxe->ndev, &ks);
speed = ks.base.speed;
} else if (rxe->ndev->ethtool_ops->get_settings) {
struct ethtool_cmd cmd;
- rxe->ndev->ethtool_ops->get_settings(rxe->ndev, &cmd);
+ rc = rxe->ndev->ethtool_ops->get_settings(rxe->ndev, &cmd);
speed = cmd.speed;
- } else {
+ }
+ if (rc) {
pr_warn("%s speed is unknown, defaulting to 1000\n",
rxe->ndev->name);
speed = 1000;
The functions get_link_ksettings and get_settings might return bad status indicating a failure to retrieve interface atttibutes. Check return value to cover this case. Signed-off-by: Yuval Shaia <yuval.shaia@oracle.com> --- drivers/infiniband/sw/rxe/rxe_verbs.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)