[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20191023.191320.2221170454789484606.davem@davemloft.net>
Date: Wed, 23 Oct 2019 19:13:20 -0700 (PDT)
From: David Miller <davem@...emloft.net>
To: andrew@...n.ch
Cc: netdev@...r.kernel.org, dan.carpenter@...cle.com
Subject: Re: [PATCH net-next] net: of_get_phy_mode: Change API to solve
int/unit warnings
From: Andrew Lunn <andrew@...n.ch>
Date: Tue, 22 Oct 2019 03:18:17 +0200
> Before this change of_get_phy_mode() returned an enum,
> phy_interface_t. On error, -ENODEV etc, is returned. If the result of
> the function is stored in a variable of type phy_interface_t, and the
> compiler has decided to represent this as an unsigned int, comparision
> with -ENODEV etc, is a signed vs unsigned comparision.
>
> Fix this problem by changing the API. Make the function return an
> error, or 0 on success, and pass a pointer, of type phy_interface_t,
> where the phy mode should be stored.
>
> Reported-by: Dan Carpenter <dan.carpenter@...cle.com>
> Signed-off-by: Andrew Lunn <andrew@...n.ch>
So now we have code that uses the 'interface' value without checking
the error return value which means it's potentially uninitialized.
There are also a bunch of reverse christmas tree violations created
by this patch as well :-) :-) :-)
Powered by blists - more mailing lists