mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Corentin Labbe <clabbe@baylibre.com>
To: davem@davemloft.net, edumazet@google.com, khalasa@piap.pl,
	kuba@kernel.org, pabeni@redhat.com
Cc: linux-kernel@vger.kernel.org, netdev@vger.kernel.org,
	Corentin Labbe <clabbe@baylibre.com>
Subject: [PATCH 3/4] net: ethernet: xscale: remove assignment in if condition
Date: Wed,  5 Oct 2022 12:05:00 +0000	[thread overview]
Message-ID: <20221005120501.3527435-3-clabbe@baylibre.com> (raw)
In-Reply-To: <20221005120501.3527435-1-clabbe@baylibre.com>

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

Signed-off-by: Corentin Labbe <clabbe@baylibre.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


  parent reply	other threads:[~2022-10-05 12:05 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-05 12:04 [PATCH 1/4] net: ethernet: xscale: fix space style issues Corentin Labbe
2022-10-05 12:04 ` [PATCH 2/4] net: ethernet: xscale: fix printk issues Corentin Labbe
2022-10-05 12:05 ` Corentin Labbe [this message]
2022-10-05 12:05 ` [PATCH 4/4] net: ethernet: xscale: fix easy remaining style issues Corentin Labbe
2022-10-06  3:35 ` [PATCH 1/4] net: ethernet: xscale: fix space " Jakub Kicinski
2022-10-06  4:40   ` LABBE Corentin
2022-10-06 15:06     ` Jakub Kicinski

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=20221005120501.3527435-3-clabbe@baylibre.com \
    --to=clabbe@baylibre.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=khalasa@piap.pl \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.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

Powered by JetHome