* [PATCH net] net: socionext: Fix a signedness bug in ave_probe()
@ 2019-09-25 10:57 Dan Carpenter
2019-09-26 6:28 ` Kunihiko Hayashi
2019-09-27 8:14 ` David Miller
0 siblings, 2 replies; 3+ messages in thread
From: Dan Carpenter @ 2019-09-25 10:57 UTC (permalink / raw)
To: Kunihiko Hayashi; +Cc: David S. Miller, netdev, kernel-janitors
The "phy_mode" variable is an enum and in this context GCC treats it as
an unsigned int so the error handling is never triggered.
Fixes: 4c270b55a5af ("net: ethernet: socionext: add AVE ethernet driver")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
drivers/net/ethernet/socionext/sni_ave.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/socionext/sni_ave.c b/drivers/net/ethernet/socionext/sni_ave.c
index 10d0c3e478ab..d047a53f34f2 100644
--- a/drivers/net/ethernet/socionext/sni_ave.c
+++ b/drivers/net/ethernet/socionext/sni_ave.c
@@ -1566,7 +1566,7 @@ static int ave_probe(struct platform_device *pdev)
np = dev->of_node;
phy_mode = of_get_phy_mode(np);
- if (phy_mode < 0) {
+ if ((int)phy_mode < 0) {
dev_err(dev, "phy-mode not found\n");
return -EINVAL;
}
--
2.20.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH net] net: socionext: Fix a signedness bug in ave_probe()
2019-09-25 10:57 [PATCH net] net: socionext: Fix a signedness bug in ave_probe() Dan Carpenter
@ 2019-09-26 6:28 ` Kunihiko Hayashi
2019-09-27 8:14 ` David Miller
1 sibling, 0 replies; 3+ messages in thread
From: Kunihiko Hayashi @ 2019-09-26 6:28 UTC (permalink / raw)
To: Dan Carpenter; +Cc: David S. Miller, netdev, kernel-janitors
Hi Dan,
Thank you for pointing out.
I've confirmed that this error handling works well with your patch.
Reviewed-by: Kunihiko Hayashi <hayashi.kunihiko@socionext.com>
Thank you,
On Wed, 25 Sep 2019 13:57:50 +0300 <dan.carpenter@oracle.com> wrote:
> The "phy_mode" variable is an enum and in this context GCC treats it as
> an unsigned int so the error handling is never triggered.
>
> Fixes: 4c270b55a5af ("net: ethernet: socionext: add AVE ethernet driver")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> ---
> drivers/net/ethernet/socionext/sni_ave.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/net/ethernet/socionext/sni_ave.c b/drivers/net/ethernet/socionext/sni_ave.c
> index 10d0c3e478ab..d047a53f34f2 100644
> --- a/drivers/net/ethernet/socionext/sni_ave.c
> +++ b/drivers/net/ethernet/socionext/sni_ave.c
> @@ -1566,7 +1566,7 @@ static int ave_probe(struct platform_device *pdev)
>
> np = dev->of_node;
> phy_mode = of_get_phy_mode(np);
> - if (phy_mode < 0) {
> + if ((int)phy_mode < 0) {
> dev_err(dev, "phy-mode not found\n");
> return -EINVAL;
> }
> --
> 2.20.1
---
Best Regards,
Kunihiko Hayashi
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH net] net: socionext: Fix a signedness bug in ave_probe()
2019-09-25 10:57 [PATCH net] net: socionext: Fix a signedness bug in ave_probe() Dan Carpenter
2019-09-26 6:28 ` Kunihiko Hayashi
@ 2019-09-27 8:14 ` David Miller
1 sibling, 0 replies; 3+ messages in thread
From: David Miller @ 2019-09-27 8:14 UTC (permalink / raw)
To: dan.carpenter; +Cc: hayashi.kunihiko, netdev, kernel-janitors
From: Dan Carpenter <dan.carpenter@oracle.com>
Date: Wed, 25 Sep 2019 13:57:50 +0300
> The "phy_mode" variable is an enum and in this context GCC treats it as
> an unsigned int so the error handling is never triggered.
>
> Fixes: 4c270b55a5af ("net: ethernet: socionext: add AVE ethernet driver")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Applied.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2019-09-27 8:14 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-09-25 10:57 [PATCH net] net: socionext: Fix a signedness bug in ave_probe() Dan Carpenter
2019-09-26 6:28 ` Kunihiko Hayashi
2019-09-27 8:14 ` David Miller
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).