All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] staging: most: hdm-usb: Fix sparse warning cast to restricted __le16
@ 2017-01-10  3:25 Eric Salem
  2017-01-10  9:46 ` Christian Gromm
  2017-01-10 16:40 ` Greg KH
  0 siblings, 2 replies; 4+ messages in thread
From: Eric Salem @ 2017-01-10  3:25 UTC (permalink / raw)
  To: gregkh, christian.gromm, andrey.shvetsov; +Cc: devel, linux-kernel

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>
---
 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);
 
-- 
2.9.3

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] staging: most: hdm-usb: Fix sparse warning cast to restricted __le16
  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
  2017-01-10 16:40 ` Greg KH
  1 sibling, 0 replies; 4+ messages in thread
From: Christian Gromm @ 2017-01-10  9:46 UTC (permalink / raw)
  To: Eric Salem; +Cc: gregkh, andrey.shvetsov, devel, linux-kernel

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);
>  

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] staging: most: hdm-usb: Fix sparse warning cast to restricted __le16
  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
@ 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
  1 sibling, 1 reply; 4+ messages in thread
From: Greg KH @ 2017-01-10 16:40 UTC (permalink / raw)
  To: Eric Salem; +Cc: christian.gromm, andrey.shvetsov, devel, linux-kernel

On Mon, Jan 09, 2017 at 09:25:56PM -0600, Eric Salem 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(-)

This patch doesn't apply against linux-next, can you refresh it and
resend?

thanks,

greg k-h

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH v2] staging: most: hdm-usb: Fix mismatch between types used in sizeof operator
  2017-01-10 16:40 ` Greg KH
@ 2017-01-11  1:38   ` Eric Salem
  0 siblings, 0 replies; 4+ messages in thread
From: Eric Salem @ 2017-01-11  1:38 UTC (permalink / raw)
  To: Greg KH; +Cc: christian.gromm, andrey.shvetsov, devel, linux-kernel

Fixed mismatch between types used in sizeof operator.

Signed-off-by: Eric Salem <ericsalem@gmail.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 8a6da16..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;
-	__le16 *dma_buf = kzalloc(sizeof(__le16), 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);
 
-- 
2.9.3

On 01/10/2017 10:40 AM, Greg KH wrote:
> On Mon, Jan 09, 2017 at 09:25:56PM -0600, Eric Salem 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(-)
> 
> This patch doesn't apply against linux-next, can you refresh it and
> resend?
> 
> thanks,
> 
> greg k-h
> 

^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2017-01-11  1:39 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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
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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.