devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Arnd Bergmann <arnd@arndb.de>
To: Iyappan Subramanian <isubramanian@apm.com>
Cc: davem@davemloft.net, netdev@vger.kernel.org,
	devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
	patches@apm.com, linux@armlinux.org.uk
Subject: Re: [PATCH net-next 01/10] drivers: net: xgene: Fix kbuild warning
Date: Sat, 30 Jul 2016 11:13:17 +0200	[thread overview]
Message-ID: <14140485.FlkQbu0aHJ@wuerfel> (raw)
In-Reply-To: <1469838843-19943-2-git-send-email-isubramanian@apm.com>

On Friday, July 29, 2016 5:33:54 PM CEST Iyappan Subramanian wrote:
> This patch fixes the following kbuild warning, when ACPI was not enabled.
> 
> >> drivers/net/ethernet/apm/xgene/xgene_enet_hw.c:878:23: warning: 'phy_dev' may be used uninitialized in this function [-Wmaybe-uninitialized]
>      phy_dev->advertising = phy_dev->supported;

>From looking at the patch, I don't think it addresses the warning.
Note that Linus added a patch to disable the warning in the latest
mainline kernel, so you won't see it any more, but I think the bug
is still there.

> diff --git a/drivers/net/ethernet/apm/xgene/xgene_enet_hw.c b/drivers/net/ethernet/apm/xgene/xgene_enet_hw.c
> index 7714b7d..b6bc6fa 100644
> --- a/drivers/net/ethernet/apm/xgene/xgene_enet_hw.c
> +++ b/drivers/net/ethernet/apm/xgene/xgene_enet_hw.c
> @@ -776,15 +776,11 @@ int xgene_enet_phy_connect(struct net_device *ndev)
>                         netdev_err(ndev, "Could not connect to PHY\n");
>                         return -ENODEV;
>                 }
> -
> -               pdata->phy_dev = phy_dev;
>         } else {
>  #ifdef CONFIG_ACPI
>                 struct acpi_device *adev = acpi_phy_find_device(dev);
>                 if (adev)
> -                       pdata->phy_dev =  adev->driver_data;
> -
> -               phy_dev = pdata->phy_dev;
> +                       phy_dev =  adev->driver_data;
>  
>                 if (!phy_dev ||
>                     phy_connect_direct(ndev, phy_dev, &xgene_enet_adjust_link,
> @@ -795,6 +791,7 @@ int xgene_enet_phy_connect(struct net_device *ndev)
>  #endif
>         }
>  
> +       pdata->phy_dev = phy_dev;

phy_dev is not initialized anywhere if CONFIG_ACPI is not set
and dev->of_node is NULL (which should not happen in practice,
but the compiler doesn't know that).

I think you want this instead:

diff --git a/drivers/net/ethernet/apm/xgene/xgene_enet_hw.c b/drivers/net/ethernet/apm/xgene/xgene_enet_hw.c
index 7714b7d4026a..98779fe2d558 100644
--- a/drivers/net/ethernet/apm/xgene/xgene_enet_hw.c
+++ b/drivers/net/ethernet/apm/xgene/xgene_enet_hw.c
@@ -792,6 +792,8 @@ int xgene_enet_phy_connect(struct net_device *ndev)
 			netdev_err(ndev, "Could not connect to PHY\n");
 			return  -ENODEV;
 		}
+#else
+		return -ENODEV;
 #endif
 	}
 

	ARnd

	Arnd

  reply	other threads:[~2016-07-30  9:13 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-07-30  0:33 [PATCH net-next 00/10] Fix warning and issues Iyappan Subramanian
2016-07-30  0:33 ` [PATCH net-next 02/10] drivers: net: xgene: fix: Add dma_unmap_single Iyappan Subramanian
     [not found] ` <1469838843-19943-1-git-send-email-isubramanian-qTEPVZfXA3Y@public.gmane.org>
2016-07-30  0:33   ` [PATCH net-next 01/10] drivers: net: xgene: Fix kbuild warning Iyappan Subramanian
2016-07-30  9:13     ` Arnd Bergmann [this message]
2016-07-30  0:33   ` [PATCH net-next 03/10] drivers: net: xgene: fix: Delete descriptor rings and buffer pools Iyappan Subramanian
2016-07-30  0:34   ` [PATCH net-next 08/10] drivers: net: xgene: Poll link status via GPIO Iyappan Subramanian
     [not found]     ` <1469838843-19943-9-git-send-email-isubramanian-qTEPVZfXA3Y@public.gmane.org>
2016-07-30  1:56       ` kbuild test robot
2016-07-30  4:32     ` kbuild test robot
2016-07-30  5:42     ` kbuild test robot
2016-08-01  5:39     ` Quan Nguyen
2016-07-30  0:34   ` [PATCH net-next 10/10] Documentation: dtb: xgene: Add rxlos GPIO mapping Iyappan Subramanian
2016-08-01 16:35     ` Rob Herring
2016-08-02  6:03       ` Quan Nguyen
2016-07-30  3:12   ` [PATCH net-next 00/10] Fix warning and issues David Miller
2016-07-30  0:33 ` [PATCH net-next 04/10] drivers: net: xgene: Fix error deconstruction path Iyappan Subramanian
2016-07-30  0:33 ` [PATCH net-next 05/10] drivers: net: xgene: Fix RSS indirection table fields Iyappan Subramanian
2016-07-30  0:33 ` [PATCH net-next 06/10] drivers: net: xgene: Change port init sequence Iyappan Subramanian
2016-07-30  0:34 ` [PATCH net-next 07/10] drivers: net: xgene: XFI PCS reset when link is down Iyappan Subramanian
2016-07-30  0:34 ` [PATCH net-next 09/10] dtb: xgene: Add rxlos-gpios property Iyappan Subramanian

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=14140485.FlkQbu0aHJ@wuerfel \
    --to=arnd@arndb.de \
    --cc=davem@davemloft.net \
    --cc=devicetree@vger.kernel.org \
    --cc=isubramanian@apm.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux@armlinux.org.uk \
    --cc=netdev@vger.kernel.org \
    --cc=patches@apm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).