mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Markus Elfring <Markus.Elfring@web.de>
To: linux-atm-general@lists.sourceforge.net, netdev@vger.kernel.org,
	Chas Williams <3chas3@gmail.com>,
	"David S. Miller" <davem@davemloft.net>,
	David Woodhouse <David.Woodhouse@intel.com>
Cc: LKML <linux-kernel@vger.kernel.org>,
	kernel-janitors@vger.kernel.org,
	Miaoqian Lin <linmq006@gmail.com>
Subject: [PATCH] atm: solos-pci: Use pointer from memcpy() call for assignment in fpga_tx()
Date: Fri, 31 Oct 2025 12:42:09 +0100	[thread overview]
Message-ID: <093033d3-0ea3-49a0-83e8-621fc4fe1d24@web.de> (raw)

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Fri, 31 Oct 2025 12:30:38 +0100

A pointer was assigned to a variable. The same pointer was used for
the destination parameter of a memcpy() call.
This function is documented in the way that the same value is returned.
Thus convert two separate statements into a direct variable assignment for
the return value from a memory copy action.

The source code was transformed by using the Coccinelle software.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
 drivers/atm/solos-pci.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/drivers/atm/solos-pci.c b/drivers/atm/solos-pci.c
index d3c30a28c410..dc4aa803f3d6 100644
--- a/drivers/atm/solos-pci.c
+++ b/drivers/atm/solos-pci.c
@@ -1087,10 +1087,11 @@ static uint32_t fpga_tx(struct solos_card *card)
 				oldskb = skb; /* We're done with this skb already */
 			} else if (skb && card->using_dma) {
 				unsigned char *data = skb->data;
-				if ((unsigned long)data & card->dma_alignment) {
-					data = card->dma_bounce + (BUF_SIZE * port);
-					memcpy(data, skb->data, skb->len);
-				}
+
+				if ((unsigned long)data & card->dma_alignment)
+					data = memcpy(card->dma_bounce + (BUF_SIZE * port),
+						      skb->data, skb->len);
+
 				SKB_CB(skb)->dma_addr = dma_map_single(&card->dev->dev, data,
 								       skb->len, DMA_TO_DEVICE);
 				card->tx_skb[port] = skb;
-- 
2.51.1


             reply	other threads:[~2025-10-31 11:42 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-10-31 11:42 Markus Elfring [this message]
2025-11-03 14:32 ` Simon Horman

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=093033d3-0ea3-49a0-83e8-621fc4fe1d24@web.de \
    --to=markus.elfring@web.de \
    --cc=3chas3@gmail.com \
    --cc=David.Woodhouse@intel.com \
    --cc=davem@davemloft.net \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linmq006@gmail.com \
    --cc=linux-atm-general@lists.sourceforge.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®