public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Christian Gromm <christian.gromm@microchip.com>
To: Eric Salem <ericsalem@gmail.com>
Cc: <gregkh@linuxfoundation.org>, <andrey.shvetsov@k2l.de>,
	<devel@driverdev.osuosl.org>, <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] staging: most: hdm-usb: Fix sparse warning cast to restricted __le16
Date: Tue, 10 Jan 2017 10:46:16 +0100	[thread overview]
Message-ID: <20170110104616.69f75a70@muaddib> (raw)
In-Reply-To: <7b68565e-61da-cfa4-4015-623657d2ae47@gmail.com>

On Mon, 9 Jan 2017 21:25:56 -0600
Eric Salem <ericsalem@gmail.com> wrote:

> Fixed the following sparse warning:
> 
> drivers/staging/most/hdm-usb/hdm_usb.c:158:16: warning:
> cast to restricted __le16
> 
> by correcting the variable's type (also updated sizeof).
> 
> Signed-off-by: Eric Salem <ericsalem@gmail.com>

Acked-by: Christian Gromm <christian.gromm@microchip.com>

> ---
>  drivers/staging/most/hdm-usb/hdm_usb.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/staging/most/hdm-usb/hdm_usb.c b/drivers/staging/most/hdm-usb/hdm_usb.c
> index d6db0bd..01e3a31 100644
> --- a/drivers/staging/most/hdm-usb/hdm_usb.c
> +++ b/drivers/staging/most/hdm-usb/hdm_usb.c
> @@ -145,7 +145,7 @@ static void wq_netinfo(struct work_struct *wq_obj);
>  static inline int drci_rd_reg(struct usb_device *dev, u16 reg, u16 *buf)
>  {
>  	int retval;
> -	u16 *dma_buf = kzalloc(sizeof(u16), GFP_KERNEL);
> +	__le16 *dma_buf = kzalloc(sizeof(*dma_buf), GFP_KERNEL);
>  	u8 req_type = USB_DIR_IN | USB_TYPE_VENDOR | USB_RECIP_DEVICE;
>  
>  	if (!dma_buf)
> @@ -154,7 +154,7 @@ static inline int drci_rd_reg(struct usb_device *dev, u16 reg, u16 *buf)
>  	retval = usb_control_msg(dev, usb_rcvctrlpipe(dev, 0),
>  				 DRCI_READ_REQ, req_type,
>  				 0x0000,
> -				 reg, dma_buf, sizeof(u16), 5 * HZ);
> +				 reg, dma_buf, sizeof(*dma_buf), 5 * HZ);
>  	*buf = le16_to_cpu(*dma_buf);
>  	kfree(dma_buf);
>  

  reply	other threads:[~2017-01-10  9:45 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-01-10  3:25 [PATCH] staging: most: hdm-usb: Fix sparse warning cast to restricted __le16 Eric Salem
2017-01-10  9:46 ` Christian Gromm [this message]
2017-01-10 16:40 ` Greg KH
2017-01-11  1:38   ` [PATCH v2] staging: most: hdm-usb: Fix mismatch between types used in sizeof operator Eric Salem

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=20170110104616.69f75a70@muaddib \
    --to=christian.gromm@microchip.com \
    --cc=andrey.shvetsov@k2l.de \
    --cc=devel@driverdev.osuosl.org \
    --cc=ericsalem@gmail.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@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