mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Markus Elfring <Markus.Elfring@web.de>
To: greybus-dev@lists.linaro.org, Alex Elder <elder@kernel.org>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Johan Hovold <johan@kernel.org>
Cc: LKML <linux-kernel@vger.kernel.org>,
	kernel-janitors@vger.kernel.org,
	Mark Greer <mgreer@animalcreek.com>,
	Miaoqian Lin <linmq006@gmail.com>
Subject: [PATCH] greybus: es2: Use pointer from memcpy() call for assignment in output_async()
Date: Fri, 31 Oct 2025 19:57:47 +0100	[thread overview]
Message-ID: <b542b028-4f9b-44cd-aca7-5d4977c2faa4@web.de> (raw)

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Fri, 31 Oct 2025 19:50:39 +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/greybus/es2.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/greybus/es2.c b/drivers/greybus/es2.c
index 7630a36ecf81..d71d37b41a66 100644
--- a/drivers/greybus/es2.c
+++ b/drivers/greybus/es2.c
@@ -194,8 +194,7 @@ static int output_async(struct es2_ap_dev *es2, void *req, u16 size, u8 cmd)
 		return -ENOMEM;
 	}
 
-	buf = (u8 *)dr + sizeof(*dr);
-	memcpy(buf, req, size);
+	buf = memcpy((u8 *)dr + sizeof(*dr), req, size);
 
 	dr->bRequest = cmd;
 	dr->bRequestType = USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_INTERFACE;
-- 
2.51.1


             reply	other threads:[~2025-10-31 18:58 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-10-31 18:57 Markus Elfring [this message]
2025-11-04 11:41 ` Johan Hovold
2025-11-04 11:55   ` Markus Elfring

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=b542b028-4f9b-44cd-aca7-5d4977c2faa4@web.de \
    --to=markus.elfring@web.de \
    --cc=elder@kernel.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=greybus-dev@lists.linaro.org \
    --cc=johan@kernel.org \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linmq006@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mgreer@animalcreek.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

all inboxes | Powered by JetHome®