All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: kbuild@lists.01.org
Subject: drivers/net/dsa/sja1105/sja1105_main.c:1608 sja1105_static_config_reload() warn: bitwise AND condition is false here
Date: Mon, 31 Aug 2020 15:33:18 +0300	[thread overview]
Message-ID: <20200831123317.GL8299@kadam> (raw)

[-- Attachment #1: Type: text/plain, Size: 3350 bytes --]

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   4d41ead6ead97c3730bbd186a601a64828668f01
commit: ffe10e679cec9a99f19049459cb27c2fbb1e913a net: dsa: sja1105: Add support for the SGMII port
config: arm-randconfig-m031-20200829 (attached as .config)
compiler: arm-linux-gnueabi-gcc (GCC) 9.3.0

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>

New smatch warnings:
drivers/net/dsa/sja1105/sja1105_main.c:1608 sja1105_static_config_reload() warn: bitwise AND condition is false here

# https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=ffe10e679cec9a99f19049459cb27c2fbb1e913a
git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
git fetch --no-tags linus master
git checkout ffe10e679cec9a99f19049459cb27c2fbb1e913a
vim +1608 drivers/net/dsa/sja1105/sja1105_main.c

6666cebc5e306f Vladimir Oltean 2019-05-02  1590  	for (i = 0; i < SJA1105_NUM_PORTS; i++) {
8400cff60b472c Vladimir Oltean 2019-06-08  1591  		rc = sja1105_adjust_port_config(priv, i, speed_mbps[i]);
6666cebc5e306f Vladimir Oltean 2019-05-02  1592  		if (rc < 0)
6666cebc5e306f Vladimir Oltean 2019-05-02  1593  			goto out;
6666cebc5e306f Vladimir Oltean 2019-05-02  1594  	}
ffe10e679cec9a Vladimir Oltean 2020-03-20  1595  
ffe10e679cec9a Vladimir Oltean 2020-03-20  1596  	if (sja1105_supports_sgmii(priv, SJA1105_SGMII_PORT)) {
ffe10e679cec9a Vladimir Oltean 2020-03-20  1597  		bool an_enabled = !!(bmcr & BMCR_ANENABLE);
ffe10e679cec9a Vladimir Oltean 2020-03-20  1598  
ffe10e679cec9a Vladimir Oltean 2020-03-20  1599  		sja1105_sgmii_pcs_config(priv, an_enabled, false);
ffe10e679cec9a Vladimir Oltean 2020-03-20  1600  
ffe10e679cec9a Vladimir Oltean 2020-03-20  1601  		if (!an_enabled) {
ffe10e679cec9a Vladimir Oltean 2020-03-20  1602  			int speed = SPEED_UNKNOWN;
ffe10e679cec9a Vladimir Oltean 2020-03-20  1603  
ffe10e679cec9a Vladimir Oltean 2020-03-20  1604  			if (bmcr & BMCR_SPEED1000)
ffe10e679cec9a Vladimir Oltean 2020-03-20  1605  				speed = SPEED_1000;
ffe10e679cec9a Vladimir Oltean 2020-03-20  1606  			else if (bmcr & BMCR_SPEED100)
ffe10e679cec9a Vladimir Oltean 2020-03-20  1607  				speed = SPEED_100;
ffe10e679cec9a Vladimir Oltean 2020-03-20 @1608  			else if (bmcr & BMCR_SPEED10)
                                                                                 ^^^^^^^^^^^^^^^^^^^
This is an impossible condition.  BMCR_SPEED10 is zero.

ffe10e679cec9a Vladimir Oltean 2020-03-20  1609  				speed = SPEED_10;
ffe10e679cec9a Vladimir Oltean 2020-03-20  1610  
ffe10e679cec9a Vladimir Oltean 2020-03-20  1611  			sja1105_sgmii_pcs_force_speed(priv, speed);
ffe10e679cec9a Vladimir Oltean 2020-03-20  1612  		}
ffe10e679cec9a Vladimir Oltean 2020-03-20  1613  	}
6666cebc5e306f Vladimir Oltean 2019-05-02  1614  out:
af580ae2dcb250 Vladimir Oltean 2019-11-09  1615  	mutex_unlock(&priv->mgmt_lock);
af580ae2dcb250 Vladimir Oltean 2019-11-09  1616  
6666cebc5e306f Vladimir Oltean 2019-05-02  1617  	return rc;
6666cebc5e306f Vladimir Oltean 2019-05-02  1618  }

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org

[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 24564 bytes --]

WARNING: multiple messages have this Message-ID (diff)
From: Dan Carpenter <dan.carpenter@oracle.com>
To: kbuild-all@lists.01.org
Subject: drivers/net/dsa/sja1105/sja1105_main.c:1608 sja1105_static_config_reload() warn: bitwise AND condition is false here
Date: Mon, 31 Aug 2020 15:33:18 +0300	[thread overview]
Message-ID: <20200831123317.GL8299@kadam> (raw)

[-- Attachment #1: Type: text/plain, Size: 3350 bytes --]

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   4d41ead6ead97c3730bbd186a601a64828668f01
commit: ffe10e679cec9a99f19049459cb27c2fbb1e913a net: dsa: sja1105: Add support for the SGMII port
config: arm-randconfig-m031-20200829 (attached as .config)
compiler: arm-linux-gnueabi-gcc (GCC) 9.3.0

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>

New smatch warnings:
drivers/net/dsa/sja1105/sja1105_main.c:1608 sja1105_static_config_reload() warn: bitwise AND condition is false here

# https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=ffe10e679cec9a99f19049459cb27c2fbb1e913a
git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
git fetch --no-tags linus master
git checkout ffe10e679cec9a99f19049459cb27c2fbb1e913a
vim +1608 drivers/net/dsa/sja1105/sja1105_main.c

6666cebc5e306f Vladimir Oltean 2019-05-02  1590  	for (i = 0; i < SJA1105_NUM_PORTS; i++) {
8400cff60b472c Vladimir Oltean 2019-06-08  1591  		rc = sja1105_adjust_port_config(priv, i, speed_mbps[i]);
6666cebc5e306f Vladimir Oltean 2019-05-02  1592  		if (rc < 0)
6666cebc5e306f Vladimir Oltean 2019-05-02  1593  			goto out;
6666cebc5e306f Vladimir Oltean 2019-05-02  1594  	}
ffe10e679cec9a Vladimir Oltean 2020-03-20  1595  
ffe10e679cec9a Vladimir Oltean 2020-03-20  1596  	if (sja1105_supports_sgmii(priv, SJA1105_SGMII_PORT)) {
ffe10e679cec9a Vladimir Oltean 2020-03-20  1597  		bool an_enabled = !!(bmcr & BMCR_ANENABLE);
ffe10e679cec9a Vladimir Oltean 2020-03-20  1598  
ffe10e679cec9a Vladimir Oltean 2020-03-20  1599  		sja1105_sgmii_pcs_config(priv, an_enabled, false);
ffe10e679cec9a Vladimir Oltean 2020-03-20  1600  
ffe10e679cec9a Vladimir Oltean 2020-03-20  1601  		if (!an_enabled) {
ffe10e679cec9a Vladimir Oltean 2020-03-20  1602  			int speed = SPEED_UNKNOWN;
ffe10e679cec9a Vladimir Oltean 2020-03-20  1603  
ffe10e679cec9a Vladimir Oltean 2020-03-20  1604  			if (bmcr & BMCR_SPEED1000)
ffe10e679cec9a Vladimir Oltean 2020-03-20  1605  				speed = SPEED_1000;
ffe10e679cec9a Vladimir Oltean 2020-03-20  1606  			else if (bmcr & BMCR_SPEED100)
ffe10e679cec9a Vladimir Oltean 2020-03-20  1607  				speed = SPEED_100;
ffe10e679cec9a Vladimir Oltean 2020-03-20 @1608  			else if (bmcr & BMCR_SPEED10)
                                                                                 ^^^^^^^^^^^^^^^^^^^
This is an impossible condition.  BMCR_SPEED10 is zero.

ffe10e679cec9a Vladimir Oltean 2020-03-20  1609  				speed = SPEED_10;
ffe10e679cec9a Vladimir Oltean 2020-03-20  1610  
ffe10e679cec9a Vladimir Oltean 2020-03-20  1611  			sja1105_sgmii_pcs_force_speed(priv, speed);
ffe10e679cec9a Vladimir Oltean 2020-03-20  1612  		}
ffe10e679cec9a Vladimir Oltean 2020-03-20  1613  	}
6666cebc5e306f Vladimir Oltean 2019-05-02  1614  out:
af580ae2dcb250 Vladimir Oltean 2019-11-09  1615  	mutex_unlock(&priv->mgmt_lock);
af580ae2dcb250 Vladimir Oltean 2019-11-09  1616  
6666cebc5e306f Vladimir Oltean 2019-05-02  1617  	return rc;
6666cebc5e306f Vladimir Oltean 2019-05-02  1618  }

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org

[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 24564 bytes --]

WARNING: multiple messages have this Message-ID (diff)
From: Dan Carpenter <dan.carpenter@oracle.com>
To: kbuild@lists.01.org, Vladimir Oltean <vladimir.oltean@nxp.com>
Cc: lkp@intel.com, Dan Carpenter <error27@gmail.com>,
	kbuild-all@lists.01.org, linux-kernel@vger.kernel.org,
	Russell King <rmk+kernel@armlinux.org.uk>
Subject: drivers/net/dsa/sja1105/sja1105_main.c:1608 sja1105_static_config_reload() warn: bitwise AND condition is false here
Date: Mon, 31 Aug 2020 15:33:18 +0300	[thread overview]
Message-ID: <20200831123317.GL8299@kadam> (raw)

[-- Attachment #1: Type: text/plain, Size: 3293 bytes --]

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   4d41ead6ead97c3730bbd186a601a64828668f01
commit: ffe10e679cec9a99f19049459cb27c2fbb1e913a net: dsa: sja1105: Add support for the SGMII port
config: arm-randconfig-m031-20200829 (attached as .config)
compiler: arm-linux-gnueabi-gcc (GCC) 9.3.0

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>

New smatch warnings:
drivers/net/dsa/sja1105/sja1105_main.c:1608 sja1105_static_config_reload() warn: bitwise AND condition is false here

# https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=ffe10e679cec9a99f19049459cb27c2fbb1e913a
git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
git fetch --no-tags linus master
git checkout ffe10e679cec9a99f19049459cb27c2fbb1e913a
vim +1608 drivers/net/dsa/sja1105/sja1105_main.c

6666cebc5e306f Vladimir Oltean 2019-05-02  1590  	for (i = 0; i < SJA1105_NUM_PORTS; i++) {
8400cff60b472c Vladimir Oltean 2019-06-08  1591  		rc = sja1105_adjust_port_config(priv, i, speed_mbps[i]);
6666cebc5e306f Vladimir Oltean 2019-05-02  1592  		if (rc < 0)
6666cebc5e306f Vladimir Oltean 2019-05-02  1593  			goto out;
6666cebc5e306f Vladimir Oltean 2019-05-02  1594  	}
ffe10e679cec9a Vladimir Oltean 2020-03-20  1595  
ffe10e679cec9a Vladimir Oltean 2020-03-20  1596  	if (sja1105_supports_sgmii(priv, SJA1105_SGMII_PORT)) {
ffe10e679cec9a Vladimir Oltean 2020-03-20  1597  		bool an_enabled = !!(bmcr & BMCR_ANENABLE);
ffe10e679cec9a Vladimir Oltean 2020-03-20  1598  
ffe10e679cec9a Vladimir Oltean 2020-03-20  1599  		sja1105_sgmii_pcs_config(priv, an_enabled, false);
ffe10e679cec9a Vladimir Oltean 2020-03-20  1600  
ffe10e679cec9a Vladimir Oltean 2020-03-20  1601  		if (!an_enabled) {
ffe10e679cec9a Vladimir Oltean 2020-03-20  1602  			int speed = SPEED_UNKNOWN;
ffe10e679cec9a Vladimir Oltean 2020-03-20  1603  
ffe10e679cec9a Vladimir Oltean 2020-03-20  1604  			if (bmcr & BMCR_SPEED1000)
ffe10e679cec9a Vladimir Oltean 2020-03-20  1605  				speed = SPEED_1000;
ffe10e679cec9a Vladimir Oltean 2020-03-20  1606  			else if (bmcr & BMCR_SPEED100)
ffe10e679cec9a Vladimir Oltean 2020-03-20  1607  				speed = SPEED_100;
ffe10e679cec9a Vladimir Oltean 2020-03-20 @1608  			else if (bmcr & BMCR_SPEED10)
                                                                                 ^^^^^^^^^^^^^^^^^^^
This is an impossible condition.  BMCR_SPEED10 is zero.

ffe10e679cec9a Vladimir Oltean 2020-03-20  1609  				speed = SPEED_10;
ffe10e679cec9a Vladimir Oltean 2020-03-20  1610  
ffe10e679cec9a Vladimir Oltean 2020-03-20  1611  			sja1105_sgmii_pcs_force_speed(priv, speed);
ffe10e679cec9a Vladimir Oltean 2020-03-20  1612  		}
ffe10e679cec9a Vladimir Oltean 2020-03-20  1613  	}
6666cebc5e306f Vladimir Oltean 2019-05-02  1614  out:
af580ae2dcb250 Vladimir Oltean 2019-11-09  1615  	mutex_unlock(&priv->mgmt_lock);
af580ae2dcb250 Vladimir Oltean 2019-11-09  1616  
6666cebc5e306f Vladimir Oltean 2019-05-02  1617  	return rc;
6666cebc5e306f Vladimir Oltean 2019-05-02  1618  }

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 24564 bytes --]

             reply	other threads:[~2020-08-31 12:33 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-08-31 12:33 Dan Carpenter [this message]
2020-08-31 12:33 ` drivers/net/dsa/sja1105/sja1105_main.c:1608 sja1105_static_config_reload() warn: bitwise AND condition is false here Dan Carpenter
2020-08-31 12:33 ` Dan Carpenter
  -- strict thread matches above, loose matches on Subject: below --
2020-08-29  8:58 kernel test robot

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=20200831123317.GL8299@kadam \
    --to=dan.carpenter@oracle.com \
    --cc=kbuild@lists.01.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.