From: Russell King (Oracle) Date: Thu, 17 Oct 2024 11:52:44 +0000 (+0100) Subject: net: pcs: xpcs: remove switch() in xpcs_link_up_1000basex() X-Git-Tag: v6.13-rc1~135^2~234^2~5 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8d2aeab4ce782df9d7cd035938f4545af7db260e;p=thirdparty%2Fkernel%2Fstable.git net: pcs: xpcs: remove switch() in xpcs_link_up_1000basex() Remove an unnecessary switch() statement in xpcs_link_up_1000basex(). The only value this switch statement is interested in is SPEED_1000, all other values lead to an error. Replace this with a simple if() statement. Signed-off-by: Russell King (Oracle) Tested-by: Serge Semin Signed-off-by: Paolo Abeni --- diff --git a/drivers/net/pcs/pcs-xpcs.c b/drivers/net/pcs/pcs-xpcs.c index a5e2d93db2854..183df8f8c50fd 100644 --- a/drivers/net/pcs/pcs-xpcs.c +++ b/drivers/net/pcs/pcs-xpcs.c @@ -1127,18 +1127,13 @@ static void xpcs_link_up_1000basex(struct dw_xpcs *xpcs, unsigned int neg_mode, if (neg_mode == PHYLINK_PCS_NEG_INBAND_ENABLED) return; - switch (speed) { - case SPEED_1000: - val = BMCR_SPEED1000; - break; - case SPEED_100: - case SPEED_10: - default: - dev_err(&xpcs->mdiodev->dev, "%s: speed = %d\n", + if (speed != SPEED_1000) { + dev_err(&xpcs->mdiodev->dev, "%s: speed %dMbps not supported\n", __func__, speed); return; } + val = BMCR_SPEED1000; if (duplex == DUPLEX_FULL) val |= BMCR_FULLDPLX; else