From patchwork Mon Oct 25 21:12:38 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nathan Chancellor X-Patchwork-Id: 12583001 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 10D25C433F5 for ; Mon, 25 Oct 2021 21:13:09 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id ED0BE61073 for ; Mon, 25 Oct 2021 21:13:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234868AbhJYVP3 (ORCPT ); Mon, 25 Oct 2021 17:15:29 -0400 Received: from mail.kernel.org ([198.145.29.99]:43794 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234509AbhJYVP3 (ORCPT ); Mon, 25 Oct 2021 17:15:29 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 14C8860E05; Mon, 25 Oct 2021 21:13:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1635196386; bh=01iIj49VElT6TxzwlH2LuH1RkkRDZAWZcL+HbJ6Tfos=; h=From:To:Cc:Subject:Date:From; b=RAwiXnqdWfSWuhGEEmo5Exx4YcI688hOL5Gd45gpTSvLCwk7JKUbGAg7orzXTXcFv RS45vvWuH3a4r4ekE6LsvA4i5JUY4IdW6B0NFjYvKvVhSbs4/AICXOIXyfob8FOGpW 7i8Ce3HT2Dfn1CN54u3KJHTWbGJ+39eo03p2LAdhSk8GSbLjawrTvLy7KfbKIAjVsf tr6SBYTl40R+aahuACM1qoaKsljTFnhyOQsGpWM26DKJ7K54P7hCH7+vgJ/hvK8yvf YKXi8WSlfsLEGnh7NQTNd5N6LNEA2JR7El4nD/6ffiSXoARytzTuB8D0ZyHCbkV69e dckyieN7dZszA== From: Nathan Chancellor To: =?utf-8?q?=C5=81ukasz_Stelmach?= , "David S. Miller" , Jakub Kicinski Cc: Nick Desaulniers , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, llvm@lists.linux.dev, Nathan Chancellor Subject: [PATCH 1/2] net: ax88796c: Fix clang -Wimplicit-fallthrough in ax88796c_set_mac() Date: Mon, 25 Oct 2021 14:12:38 -0700 Message-Id: <20211025211238.178768-1-nathan@kernel.org> X-Mailer: git-send-email 2.33.1.637.gf443b226ca MIME-Version: 1.0 X-Patchwork-Bot: notify Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org Clang warns: drivers/net/ethernet/asix/ax88796c_main.c:696:2: error: unannotated fall-through between switch labels [-Werror,-Wimplicit-fallthrough] case SPEED_10: ^ drivers/net/ethernet/asix/ax88796c_main.c:696:2: note: insert 'break;' to avoid fall-through case SPEED_10: ^ break; drivers/net/ethernet/asix/ax88796c_main.c:706:2: error: unannotated fall-through between switch labels [-Werror,-Wimplicit-fallthrough] case DUPLEX_HALF: ^ drivers/net/ethernet/asix/ax88796c_main.c:706:2: note: insert 'break;' to avoid fall-through case DUPLEX_HALF: ^ break; Clang is a little more pedantic than GCC, which permits implicit fallthroughs to cases that contain just break or return. Clang's version is more in line with the kernel's own stance in deprecated.rst, which states that all switch/case blocks must end in either break, fallthrough, continue, goto, or return. Add the missing breaks to fix the warning. Link: https://github.com/ClangBuiltLinux/linux/issues/1491 Signed-off-by: Nathan Chancellor --- drivers/net/ethernet/asix/ax88796c_main.c | 2 ++ 1 file changed, 2 insertions(+) base-commit: dcd63d4326802cec525de2a4775019849958125c diff --git a/drivers/net/ethernet/asix/ax88796c_main.c b/drivers/net/ethernet/asix/ax88796c_main.c index cfc597f72e3d..cf0f96f93f3b 100644 --- a/drivers/net/ethernet/asix/ax88796c_main.c +++ b/drivers/net/ethernet/asix/ax88796c_main.c @@ -693,6 +693,7 @@ static void ax88796c_set_mac(struct ax88796c_device *ax_local) switch (ax_local->speed) { case SPEED_100: maccr |= MACCR_SPEED_100; + break; case SPEED_10: case SPEED_UNKNOWN: break; @@ -703,6 +704,7 @@ static void ax88796c_set_mac(struct ax88796c_device *ax_local) switch (ax_local->duplex) { case DUPLEX_FULL: maccr |= MACCR_SPEED_100; + break; case DUPLEX_HALF: case DUPLEX_UNKNOWN: break; From patchwork Mon Oct 25 21:12:39 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nathan Chancellor X-Patchwork-Id: 12583003 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 774B3C433EF for ; Mon, 25 Oct 2021 21:13:14 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 5E38461073 for ; Mon, 25 Oct 2021 21:13:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234980AbhJYVPf (ORCPT ); Mon, 25 Oct 2021 17:15:35 -0400 Received: from mail.kernel.org ([198.145.29.99]:43872 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232947AbhJYVPc (ORCPT ); Mon, 25 Oct 2021 17:15:32 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 9821D61076; Mon, 25 Oct 2021 21:13:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1635196390; bh=c6x2a88MQiWLoeRudW1085kFp+7uZbDkUgE4fWXHX6Y=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=V11DS4EhoXg/IP836OngKffoHlWvCmfDiYB+ZyodhbececGE+474cAzIoM2YE1ZB8 QRymtDMVVMFaGmCFiaRfKII90IBhWZo1Uvk5Rq1ihjhVtHf/qXuiIP/jFMINQCFFmW S/hyRUg8H6Jq9Jis7Xf5TPCFHjjZA4ZYT6OB7Ax3uNfbK0n7yzGbrdGgBw82xmYkj8 7RRVJSVvVl3xARpU0PReLY9pdqSirIsz5vTdaihbG9hM+HBAzdXPg8bYloX715t8Tp +3FSNs9Fwu9VfXqNenD52Ir6pwtaMRdOLYLWbdvyYjO5ByeZA7JpT5ZdEIgb5OSzI+ SWPtMom0xD0iw== From: Nathan Chancellor To: =?utf-8?q?=C5=81ukasz_Stelmach?= , "David S. Miller" , Jakub Kicinski Cc: Nick Desaulniers , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, llvm@lists.linux.dev, Nathan Chancellor Subject: [PATCH 2/2] net: ax88796c: Remove pointless check in ax88796c_open() Date: Mon, 25 Oct 2021 14:12:39 -0700 Message-Id: <20211025211238.178768-2-nathan@kernel.org> X-Mailer: git-send-email 2.33.1.637.gf443b226ca In-Reply-To: <20211025211238.178768-1-nathan@kernel.org> References: <20211025211238.178768-1-nathan@kernel.org> MIME-Version: 1.0 X-Patchwork-Bot: notify Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org Clang warns: drivers/net/ethernet/asix/ax88796c_main.c:851:24: error: address of array 'ax_local->phydev->advertising' will always evaluate to 'true' [-Werror,-Wpointer-bool-conversion] if (ax_local->phydev->advertising && ~~~~~~~~~~~~~~~~~~^~~~~~~~~~~ ~~ advertising cannot be NULL here if ax_local is not NULL, which cannot happen due to the check in ax88796c_probe(). Remove the check. Link: https://github.com/ClangBuiltLinux/linux/issues/1492 Signed-off-by: Nathan Chancellor --- drivers/net/ethernet/asix/ax88796c_main.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/drivers/net/ethernet/asix/ax88796c_main.c b/drivers/net/ethernet/asix/ax88796c_main.c index cf0f96f93f3b..528a0c43540b 100644 --- a/drivers/net/ethernet/asix/ax88796c_main.c +++ b/drivers/net/ethernet/asix/ax88796c_main.c @@ -850,11 +850,10 @@ ax88796c_open(struct net_device *ndev) /* Setup flow-control configuration */ phy_support_asym_pause(ax_local->phydev); - if (ax_local->phydev->advertising && - (linkmode_test_bit(ETHTOOL_LINK_MODE_Pause_BIT, - ax_local->phydev->advertising) || - linkmode_test_bit(ETHTOOL_LINK_MODE_Asym_Pause_BIT, - ax_local->phydev->advertising))) + if (linkmode_test_bit(ETHTOOL_LINK_MODE_Pause_BIT, + ax_local->phydev->advertising) || + linkmode_test_bit(ETHTOOL_LINK_MODE_Asym_Pause_BIT, + ax_local->phydev->advertising)) fc |= AX_FC_ANEG; fc |= linkmode_test_bit(ETHTOOL_LINK_MODE_Pause_BIT,