[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAOhMmr701LecfuNM+EozqbiTxFvDiXjFdY2aYeKJYaXq9kqVDg@mail.gmail.com>
Date: Mon, 3 May 2021 13:21:00 -0500
From: Lijun Pan <lijunp213@...il.com>
To: Michal Suchanek <msuchanek@...e.de>
Cc: netdev@...r.kernel.org, Michael Ellerman <mpe@...erman.id.au>,
Benjamin Herrenschmidt <benh@...nel.crashing.org>,
Paul Mackerras <paulus@...ba.org>,
Dany Madden <drt@...ux.ibm.com>,
Sukadev Bhattiprolu <sukadev@...ux.ibm.com>,
Thomas Falcon <tlfalcon@...ux.ibm.com>,
"David S. Miller" <davem@...emloft.net>,
Jakub Kicinski <kuba@...nel.org>,
linuxppc-dev@...ts.ozlabs.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] ibmvnic: remove default label from to_string switch
On Mon, May 3, 2021 at 5:54 AM Michal Suchanek <msuchanek@...e.de> wrote:
>
> This way the compiler warns when a new value is added to the enum but
> not the string transation like:
s/transation/translation/
This trick works.
Since the original code does not generate gcc warnings/errors, should
this patch be sent to net-next as an improvement?
>
> drivers/net/ethernet/ibm/ibmvnic.c: In function 'adapter_state_to_string':
> drivers/net/ethernet/ibm/ibmvnic.c:832:2: warning: enumeration value 'VNIC_FOOBAR' not handled in switch [-Wswitch]
> switch (state) {
> ^~~~~~
> drivers/net/ethernet/ibm/ibmvnic.c: In function 'reset_reason_to_string':
> drivers/net/ethernet/ibm/ibmvnic.c:1935:2: warning: enumeration value 'VNIC_RESET_FOOBAR' not handled in switch [-Wswitch]
> switch (reason) {
> ^~~~~~
>
> Signed-off-by: Michal Suchanek <msuchanek@...e.de>
> ---
Acked-by: Lijun Pan <lijunp213@...il.com>
> drivers/net/ethernet/ibm/ibmvnic.c | 6 ++----
> 1 file changed, 2 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/net/ethernet/ibm/ibmvnic.c b/drivers/net/ethernet/ibm/ibmvnic.c
> index 5788bb956d73..4d439413f6d9 100644
> --- a/drivers/net/ethernet/ibm/ibmvnic.c
> +++ b/drivers/net/ethernet/ibm/ibmvnic.c
> @@ -846,9 +846,8 @@ static const char *adapter_state_to_string(enum vnic_state state)
> return "REMOVING";
> case VNIC_REMOVED:
> return "REMOVED";
> - default:
> - return "UNKNOWN";
> }
> + return "UNKNOWN";
> }
>
> static int ibmvnic_login(struct net_device *netdev)
> @@ -1946,9 +1945,8 @@ static const char *reset_reason_to_string(enum ibmvnic_reset_reason reason)
> return "TIMEOUT";
> case VNIC_RESET_CHANGE_PARAM:
> return "CHANGE_PARAM";
> - default:
> - return "UNKNOWN";
> }
> + return "UNKNOWN";
> }
>
> /*
> --
> 2.26.2
>
Powered by blists - more mailing lists