lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20221005120501.3527435-3-clabbe@baylibre.com>
Date:   Wed,  5 Oct 2022 12:05:00 +0000
From:   Corentin Labbe <clabbe@...libre.com>
To:     davem@...emloft.net, edumazet@...gle.com, khalasa@...p.pl,
        kuba@...nel.org, pabeni@...hat.com
Cc:     linux-kernel@...r.kernel.org, netdev@...r.kernel.org,
        Corentin Labbe <clabbe@...libre.com>
Subject: [PATCH 3/4] net: ethernet: xscale: remove assignment in if condition

Fix checkpatch error about "do not use assignment in if condition";

Signed-off-by: Corentin Labbe <clabbe@...libre.com>
---
 drivers/net/ethernet/xscale/ixp4xx_eth.c | 36 ++++++++++++++++--------
 1 file changed, 24 insertions(+), 12 deletions(-)

diff --git a/drivers/net/ethernet/xscale/ixp4xx_eth.c b/drivers/net/ethernet/xscale/ixp4xx_eth.c
index b4539dd2cfe4..11e5c00f638d 100644
--- a/drivers/net/ethernet/xscale/ixp4xx_eth.c
+++ b/drivers/net/ethernet/xscale/ixp4xx_eth.c
@@ -540,7 +540,8 @@ static int ixp4xx_mdio_register(struct eth_regs __iomem *regs)
 {
 	int err;
 
-	if (!(mdio_bus = mdiobus_alloc()))
+	mdio_bus = mdiobus_alloc();
+	if (!mdio_bus)
 		return -ENOMEM;
 
 	mdio_regs = regs;
@@ -631,7 +632,8 @@ static inline int queue_get_desc(unsigned int queue, struct port *port,
 	u32 phys, tab_phys, n_desc;
 	struct desc *tab;
 
-	if (!(phys = qmgr_get_entry(queue)))
+	phys = qmgr_get_entry(queue);
+	if (!phys)
 		return -1;
 
 	phys &= ~0x1F; /* mask out non-address bits */
@@ -698,7 +700,8 @@ static int eth_poll(struct napi_struct *napi, int budget)
 		u32 phys;
 #endif
 
-		if ((n = queue_get_desc(rxq, port, 0)) < 0) {
+		n = queue_get_desc(rxq, port, 0);
+		if (n < 0) {
 #if DEBUG_RX
 			netdev_dbg(dev, "%s napi_complete\n", __func__);
 #endif
@@ -722,7 +725,8 @@ static int eth_poll(struct napi_struct *napi, int budget)
 		desc = rx_desc_ptr(port, n);
 
 #ifdef __ARMEB__
-		if ((skb = netdev_alloc_skb(dev, RX_BUFF_SIZE))) {
+		skb = netdev_alloc_skb(dev, RX_BUFF_SIZE);
+		if (skb) {
 			phys = dma_map_single(&dev->dev, skb->data,
 					      RX_BUFF_SIZE, DMA_FROM_DEVICE);
 			if (dma_mapping_error(&dev->dev, phys)) {
@@ -860,7 +864,8 @@ static netdev_tx_t eth_xmit(struct sk_buff *skb, struct net_device *dev)
 #else
 	offset = (uintptr_t)skb->data & 3; /* keep 32-bit alignment */
 	bytes = ALIGN(offset + len, 4);
-	if (!(mem = kmalloc(bytes, GFP_ATOMIC))) {
+	mem = kmalloc(bytes, GFP_ATOMIC); {
+	if (!mem) {
 		dev_kfree_skb(skb);
 		dev->stats.tx_dropped++;
 		return NETDEV_TX_OK;
@@ -1113,11 +1118,13 @@ static int init_queues(struct port *port)
 		buffer_t *buff; /* skb or kmalloc()ated memory */
 		void *data;
 #ifdef __ARMEB__
-		if (!(buff = netdev_alloc_skb(port->netdev, RX_BUFF_SIZE)))
+		buff = netdev_alloc_skb(port->netdev, RX_BUFF_SIZE);
+		if (!buff)
 			return -ENOMEM;
 		data = buff->data;
 #else
-		if (!(buff = kmalloc(RX_BUFF_SIZE, GFP_KERNEL)))
+		buff = kmalloc(RX_BUFF_SIZE, GFP_KERNEL);
+		if (!buff)
 			return -ENOMEM;
 		data = buff;
 #endif
@@ -1220,10 +1227,12 @@ static int eth_open(struct net_device *dev)
 	if (npe_send_recv_message(port->npe, &msg, "ETH_SET_FIREWALL_MODE"))
 		return -EIO;
 
-	if ((err = request_queues(port)) != 0)
+	err = request_queues(port);
+	if (err != 0)
 		return err;
 
-	if ((err = init_queues(port)) != 0) {
+	err = init_queues(port);
+	if (err != 0) {
 		destroy_queues(port);
 		release_queues(port);
 		return err;
@@ -1442,7 +1451,8 @@ static int ixp4xx_eth_probe(struct platform_device *pdev)
 	if (!plat)
 		return -ENODEV;
 
-	if (!(ndev = devm_alloc_etherdev(dev, sizeof(struct port))))
+	ndev = devm_alloc_etherdev(dev, sizeof(struct port));
+	if (!ndev)
 		return -ENOMEM;
 
 	SET_NETDEV_DEV(ndev, dev);
@@ -1479,7 +1489,8 @@ static int ixp4xx_eth_probe(struct platform_device *pdev)
 
 	netif_napi_add_weight(ndev, &port->napi, eth_poll, NAPI_WEIGHT);
 
-	if (!(port->npe = npe_request(NPE_ID(port->id))))
+	port->npe = npe_request(NPE_ID(port->id));
+	if (!port->npe)
 		return -EIO;
 
 	port->plat = plat;
@@ -1506,7 +1517,8 @@ static int ixp4xx_eth_probe(struct platform_device *pdev)
 
 	phydev->irq = PHY_POLL;
 
-	if ((err = register_netdev(ndev)))
+	err = register_netdev(ndev);
+	if (err)
 		goto err_phy_dis;
 
 	netdev_info(ndev, "%s: MII PHY %i on %s\n", ndev->name, plat->phy,
-- 
2.35.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ