diff mbox

phy: marvell: remove conflicting initializer

Message ID 20170123121905.3245589-1-arnd@arndb.de
State Accepted, archived
Delegated to: David Miller
Headers show

Commit Message

Arnd Bergmann Jan. 23, 2017, 12:18 p.m. UTC
One line was apparently pasted incorrectly during a new feature patch:

drivers/net/phy/marvell.c:2090:15: error: initialized field overwritten [-Werror=override-init]
   .features = PHY_GBIT_FEATURES,

I'm removing the extraneous line here to avoid the W=1 warning and restore
the previous flags value, and I'm slightly reordering the lines for consistency
to make it less likely to happen again in the future. The ordering in the
array is still not the same as in the structure definition, instead I picked
the order that is most common in this file and that seems to make more sense
here.

Fixes: 0b04680fdae4 ("phy: marvell: Add support for temperature sensor")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 drivers/net/phy/marvell.c | 13 ++++++-------
 1 file changed, 6 insertions(+), 7 deletions(-)

Comments

Andrew Lunn Jan. 23, 2017, 3:19 p.m. UTC | #1
On Mon, Jan 23, 2017 at 01:18:41PM +0100, Arnd Bergmann wrote:
> One line was apparently pasted incorrectly during a new feature patch:
> 
> drivers/net/phy/marvell.c:2090:15: error: initialized field overwritten [-Werror=override-init]
>    .features = PHY_GBIT_FEATURES,
> 
> I'm removing the extraneous line here to avoid the W=1 warning and restore
> the previous flags value, and I'm slightly reordering the lines for consistency
> to make it less likely to happen again in the future. The ordering in the
> array is still not the same as in the structure definition, instead I picked
> the order that is most common in this file and that seems to make more sense
> here.
> 
> Fixes: 0b04680fdae4 ("phy: marvell: Add support for temperature sensor")
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>

Hi Arnd

Thanks for this. I found one bug in my code while testing due to
duplicate probe initialisation. I was surprised at the time the
compiler did not warn me. I didn't think to try W=1. Is there any
legitimate need to allow multiple initialisation of a field? Can this
warning be made always on instead of only W=1?

Reviewed-by: Andrew Lunn <andrew@lunn.ch>

    Andrew
David Miller Jan. 24, 2017, 7:09 p.m. UTC | #2
From: Arnd Bergmann <arnd@arndb.de>
Date: Mon, 23 Jan 2017 13:18:41 +0100

> One line was apparently pasted incorrectly during a new feature patch:
> 
> drivers/net/phy/marvell.c:2090:15: error: initialized field overwritten [-Werror=override-init]
>    .features = PHY_GBIT_FEATURES,
> 
> I'm removing the extraneous line here to avoid the W=1 warning and restore
> the previous flags value, and I'm slightly reordering the lines for consistency
> to make it less likely to happen again in the future. The ordering in the
> array is still not the same as in the structure definition, instead I picked
> the order that is most common in this file and that seems to make more sense
> here.
> 
> Fixes: 0b04680fdae4 ("phy: marvell: Add support for temperature sensor")
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>

Applied, thanks Arnd.

Please start putting appropriate "net" and "net-next" strings in your
PATCH subject lines, it will save me a lot of time.
diff mbox

Patch

diff --git a/drivers/net/phy/marvell.c b/drivers/net/phy/marvell.c
index 64229976ace1..b5b73ff4329a 100644
--- a/drivers/net/phy/marvell.c
+++ b/drivers/net/phy/marvell.c
@@ -1900,8 +1900,8 @@  static struct phy_driver marvell_drivers[] = {
 		.phy_id_mask = MARVELL_PHY_ID_MASK,
 		.name = "Marvell 88E1101",
 		.features = PHY_GBIT_FEATURES,
-		.probe = marvell_probe,
 		.flags = PHY_HAS_INTERRUPT,
+		.probe = marvell_probe,
 		.config_init = &marvell_config_init,
 		.config_aneg = &marvell_config_aneg,
 		.read_status = &genphy_read_status,
@@ -1971,10 +1971,10 @@  static struct phy_driver marvell_drivers[] = {
 		.phy_id = MARVELL_PHY_ID_88E1121R,
 		.phy_id_mask = MARVELL_PHY_ID_MASK,
 		.name = "Marvell 88E1121R",
-		.probe = &m88e1121_probe,
-		.remove = &marvell_remove,
 		.features = PHY_GBIT_FEATURES,
 		.flags = PHY_HAS_INTERRUPT,
+		.probe = &m88e1121_probe,
+		.remove = &marvell_remove,
 		.config_init = &m88e1121_config_init,
 		.config_aneg = &m88e1121_config_aneg,
 		.read_status = &marvell_read_status,
@@ -2085,10 +2085,9 @@  static struct phy_driver marvell_drivers[] = {
 		.phy_id_mask = MARVELL_PHY_ID_MASK,
 		.name = "Marvell 88E1510",
 		.features = PHY_GBIT_FEATURES | SUPPORTED_FIBRE,
+		.flags = PHY_HAS_INTERRUPT,
 		.probe = &m88e1510_probe,
 		.remove = &marvell_remove,
-		.features = PHY_GBIT_FEATURES,
-		.flags = PHY_HAS_INTERRUPT,
 		.config_init = &m88e1510_config_init,
 		.config_aneg = &m88e1510_config_aneg,
 		.read_status = &marvell_read_status,
@@ -2105,10 +2104,10 @@  static struct phy_driver marvell_drivers[] = {
 		.phy_id = MARVELL_PHY_ID_88E1540,
 		.phy_id_mask = MARVELL_PHY_ID_MASK,
 		.name = "Marvell 88E1540",
-		.probe = m88e1510_probe,
-		.remove = &marvell_remove,
 		.features = PHY_GBIT_FEATURES,
 		.flags = PHY_HAS_INTERRUPT,
+		.probe = m88e1510_probe,
+		.remove = &marvell_remove,
 		.config_init = &marvell_config_init,
 		.config_aneg = &m88e1510_config_aneg,
 		.read_status = &marvell_read_status,