Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1639199 > unrolled thread

[PATCH] staging: typec: Fix sparse warnings about incorrect types

Started byGuru Das Srinagesh <gurooodas@gmail.com>
First post2017-05-11 08:00 +0200
Last post2017-05-11 19:30 +0200
Articles 2 — 2 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH] staging: typec: Fix sparse warnings about incorrect types Guru Das Srinagesh <gurooodas@gmail.com> - 2017-05-11 08:00 +0200
    Re: [PATCH] staging: typec: Fix sparse warnings about incorrect types Guenter Roeck <linux@roeck-us.net> - 2017-05-11 19:30 +0200

#1639199 — [PATCH] staging: typec: Fix sparse warnings about incorrect types

FromGuru Das Srinagesh <gurooodas@gmail.com>
Date2017-05-11 08:00 +0200
Subject[PATCH] staging: typec: Fix sparse warnings about incorrect types
Message-ID<tFPiN-2i5-3@gated-at.bofh.it>
Fix the following sparse warnings about incorrect type usage:

fusb302.c:1028:32: warning: incorrect type in argument 1 (different base types)
fusb302.c:1028:32:    expected unsigned short [unsigned] [usertype] header
fusb302.c:1028:32:    got restricted __le16 const [usertype] header
fusb302.c:1484:32: warning: incorrect type in argument 1 (different base types)
fusb302.c:1484:32:    expected unsigned short [unsigned] [usertype] header
fusb302.c:1484:32:    got restricted __le16 [usertype] header

Signed-off-by: Guru Das Srinagesh <gurooodas@gmail.com>
---
 drivers/staging/typec/fusb302/fusb302.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/typec/fusb302/fusb302.c b/drivers/staging/typec/fusb302/fusb302.c
index 2cee9a9..3bec9d5 100644
--- a/drivers/staging/typec/fusb302/fusb302.c
+++ b/drivers/staging/typec/fusb302/fusb302.c
@@ -1025,7 +1025,7 @@ static int fusb302_pd_send_message(struct fusb302_chip *chip,
 	buf[pos++] = FUSB302_TKN_SYNC1;
 	buf[pos++] = FUSB302_TKN_SYNC2;
 
-	len = pd_header_cnt(msg->header) * 4;
+	len = pd_header_cnt_le(msg->header) * 4;
 	/* plug 2 for header */
 	len += 2;
 	if (len > 0x1F) {
@@ -1481,7 +1481,7 @@ static int fusb302_pd_read_message(struct fusb302_chip *chip,
 				     (u8 *)&msg->header);
 	if (ret < 0)
 		return ret;
-	len = pd_header_cnt(msg->header) * 4;
+	len = pd_header_cnt_le(msg->header) * 4;
 	/* add 4 to length to include the CRC */
 	if (len > PD_MAX_PAYLOAD * 4) {
 		fusb302_log(chip, "PD message too long %d", len);
-- 
2.7.4

[toc] | [next] | [standalone]


#1639921

FromGuenter Roeck <linux@roeck-us.net>
Date2017-05-11 19:30 +0200
Message-ID<tG04y-RL-23@gated-at.bofh.it>
In reply to#1639199
On Wed, May 10, 2017 at 10:51:35PM -0700, Guru Das Srinagesh wrote:
> Fix the following sparse warnings about incorrect type usage:
> 
> fusb302.c:1028:32: warning: incorrect type in argument 1 (different base types)
> fusb302.c:1028:32:    expected unsigned short [unsigned] [usertype] header
> fusb302.c:1028:32:    got restricted __le16 const [usertype] header
> fusb302.c:1484:32: warning: incorrect type in argument 1 (different base types)
> fusb302.c:1484:32:    expected unsigned short [unsigned] [usertype] header
> fusb302.c:1484:32:    got restricted __le16 [usertype] header
> 
> Signed-off-by: Guru Das Srinagesh <gurooodas@gmail.com>

Reviewed-by: Guenter Roeck <linux@roeck-us.net>

> ---
>  drivers/staging/typec/fusb302/fusb302.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/staging/typec/fusb302/fusb302.c b/drivers/staging/typec/fusb302/fusb302.c
> index 2cee9a9..3bec9d5 100644
> --- a/drivers/staging/typec/fusb302/fusb302.c
> +++ b/drivers/staging/typec/fusb302/fusb302.c
> @@ -1025,7 +1025,7 @@ static int fusb302_pd_send_message(struct fusb302_chip *chip,
>  	buf[pos++] = FUSB302_TKN_SYNC1;
>  	buf[pos++] = FUSB302_TKN_SYNC2;
>  
> -	len = pd_header_cnt(msg->header) * 4;
> +	len = pd_header_cnt_le(msg->header) * 4;
>  	/* plug 2 for header */
>  	len += 2;
>  	if (len > 0x1F) {
> @@ -1481,7 +1481,7 @@ static int fusb302_pd_read_message(struct fusb302_chip *chip,
>  				     (u8 *)&msg->header);
>  	if (ret < 0)
>  		return ret;
> -	len = pd_header_cnt(msg->header) * 4;
> +	len = pd_header_cnt_le(msg->header) * 4;
>  	/* add 4 to length to include the CRC */
>  	if (len > PD_MAX_PAYLOAD * 4) {
>  		fusb302_log(chip, "PD message too long %d", len);
> -- 
> 2.7.4
> 

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web