mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Piyush Mehta <piyush.mehta@amd.com>
To: <gregkh@linuxfoundation.org>, <michal.simek@amd.com>,
	<u.kleine-koenig@pengutronix.de>, <linus.walleij@linaro.org>
Cc: <linux-usb@vger.kernel.org>,
	<linux-arm-kernel@lists.infradead.org>,
	<linux-kernel@vger.kernel.org>, <git@amd.com>,
	Piyush Mehta <piyush.mehta@amd.com>
Subject: [PATCH 2/3] usb: gadget: udc-xilinx: fix cast from restricted __le16 warning
Date: Tue, 22 Aug 2023 12:02:00 +0530	[thread overview]
Message-ID: <20230822063201.16929-3-piyush.mehta@amd.com> (raw)
In-Reply-To: <20230822063201.16929-1-piyush.mehta@amd.com>

usb_ctrlrequest member wValue, wLength and wIndex are of type __le16,
conversion macro cpu_to_le16() input argument is __u16, so properly
typecasted to fix the cast from restricted __le16 warning.

Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/all/202209020044.CX2PfZzM-lkp@intel.com/
Signed-off-by: Piyush Mehta <piyush.mehta@amd.com>
---
 drivers/usb/gadget/udc/udc-xilinx.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/usb/gadget/udc/udc-xilinx.c b/drivers/usb/gadget/udc/udc-xilinx.c
index e6308414cd1f..476c0a8fc5e7 100644
--- a/drivers/usb/gadget/udc/udc-xilinx.c
+++ b/drivers/usb/gadget/udc/udc-xilinx.c
@@ -1757,9 +1757,9 @@ static void xudc_handle_setup(struct xusb_udc *udc)
 	memcpy(&setup, ep0rambase, 8);
 
 	udc->setup = setup;
-	udc->setup.wValue = cpu_to_le16(setup.wValue);
-	udc->setup.wIndex = cpu_to_le16(setup.wIndex);
-	udc->setup.wLength = cpu_to_le16(setup.wLength);
+	udc->setup.wValue = cpu_to_le16((u16 __force)setup.wValue);
+	udc->setup.wIndex = cpu_to_le16((u16 __force)setup.wIndex);
+	udc->setup.wLength = cpu_to_le16((u16 __force)setup.wLength);
 
 	/* Clear previous requests */
 	xudc_nuke(ep0, -ECONNRESET);
-- 
2.17.1


  parent reply	other threads:[~2023-08-22  6:32 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-22  6:31 [PATCH 0/3] usb: gadget: udc-xilinx: fix warnings Piyush Mehta
2023-08-22  6:31 ` [PATCH 1/3] usb: gadget: udc-xilinx: fix restricted __le16 degrades to integer warning Piyush Mehta
2023-08-22  6:32 ` Piyush Mehta [this message]
2023-08-22  6:32 ` [PATCH 3/3] usb: gadget: udc-xilinx: fix incorrect type in assignment warning Piyush Mehta

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=20230822063201.16929-3-piyush.mehta@amd.com \
    --to=piyush.mehta@amd.com \
    --cc=git@amd.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=linus.walleij@linaro.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=michal.simek@amd.com \
    --cc=u.kleine-koenig@pengutronix.de \
    /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®