diff mbox series

usb: cdns3: make signed 1 bit bitfields unsigned

Message ID 20200325125041.94769-1-colin.king@canonical.com (mailing list archive)
State Mainlined
Commit 70d8b9e5e63d212019ba3f6823c8ec3d2df87645
Headers show
Series usb: cdns3: make signed 1 bit bitfields unsigned | expand

Commit Message

Colin King March 25, 2020, 12:50 p.m. UTC
From: Colin Ian King <colin.king@canonical.com>

The signed 1 bit bitfields should be unsigned, so make them unsigned.

Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
 drivers/usb/cdns3/cdns3-ti.c | 4 ++--
 drivers/usb/cdns3/gadget.h   | 6 +++---
 2 files changed, 5 insertions(+), 5 deletions(-)

Comments

Peter Chen March 26, 2020, 11:46 a.m. UTC | #1
On 20-03-25 12:50:41, Colin King wrote:
> From: Colin Ian King <colin.king@canonical.com>
> 
> The signed 1 bit bitfields should be unsigned, so make them unsigned.
> 
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
> ---
>  drivers/usb/cdns3/cdns3-ti.c | 4 ++--
>  drivers/usb/cdns3/gadget.h   | 6 +++---
>  2 files changed, 5 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/usb/cdns3/cdns3-ti.c b/drivers/usb/cdns3/cdns3-ti.c
> index c6a79ca15858..5685ba11480b 100644
> --- a/drivers/usb/cdns3/cdns3-ti.c
> +++ b/drivers/usb/cdns3/cdns3-ti.c
> @@ -52,8 +52,8 @@ enum modestrap_mode { USBSS_MODESTRAP_MODE_NONE,
>  struct cdns_ti {
>  	struct device *dev;
>  	void __iomem *usbss;
> -	int usb2_only:1;
> -	int vbus_divider:1;
> +	unsigned usb2_only:1;
> +	unsigned vbus_divider:1;
>  	struct clk *usb2_refclk;
>  	struct clk *lpm_clk;
>  };
> diff --git a/drivers/usb/cdns3/gadget.h b/drivers/usb/cdns3/gadget.h
> index f003a7801872..bf2828e4df2c 100644
> --- a/drivers/usb/cdns3/gadget.h
> +++ b/drivers/usb/cdns3/gadget.h
> @@ -1199,7 +1199,7 @@ struct cdns3_aligned_buf {
>  	void			*buf;
>  	dma_addr_t		dma;
>  	u32			size;
> -	int			in_use:1;
> +	unsigned		in_use:1;
>  	struct list_head	list;
>  };
>  
> @@ -1308,8 +1308,8 @@ struct cdns3_device {
>  	unsigned			u2_allowed:1;
>  	unsigned			is_selfpowered:1;
>  	unsigned			setup_pending:1;
> -	int				hw_configured_flag:1;
> -	int				wake_up_flag:1;
> +	unsigned			hw_configured_flag:1;
> +	unsigned			wake_up_flag:1;
>  	unsigned			status_completion_no_call:1;
>  	unsigned			using_streams:1;
>  	int				out_mem_is_allocated;
> -- 

Reviewed-by: Peter Chen <peter.chen@nxp.com>
kernel test robot March 26, 2020, 12:28 p.m. UTC | #2
Hi Colin,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on usb/usb-testing]
[also build test WARNING on v5.6-rc7 next-20200326]
[if your patch is applied to the wrong git tree, please drop us a note to help
improve the system. BTW, we also suggest to use '--base' option to specify the
base tree in git format-patch, please see https://stackoverflow.com/a/37406982]

url:    https://github.com/0day-ci/linux/commits/Colin-King/usb-cdns3-make-signed-1-bit-bitfields-unsigned/20200326-075855
base:   https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git usb-testing
reproduce:
        # apt-get install sparse
        # sparse version: v0.6.1-187-gbff9b106-dirty
        make ARCH=x86_64 allmodconfig
        make C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__'

If you fix the issue, kindly add following tag
Reported-by: kbuild test robot <lkp@intel.com>


sparse warnings: (new ones prefixed by >>)

>> drivers/usb/cdns3/drd.c:43:42: sparse: sparse: incorrect type in argument 1 (different address spaces) @@    expected void const volatile [noderef] <asn:2> *addr @@    got [noderef] <asn:2> *addr @@
>> drivers/usb/cdns3/drd.c:43:42: sparse:    expected void const volatile [noderef] <asn:2> *addr
>> drivers/usb/cdns3/drd.c:43:42: sparse:    got restricted __le32 *
>> drivers/usb/cdns3/drd.c:45:42: sparse: sparse: incorrect type in argument 2 (different address spaces) @@    expected void volatile [noderef] <asn:2> *addr @@    got [noderef] <asn:2> *addr @@
>> drivers/usb/cdns3/drd.c:45:42: sparse:    expected void volatile [noderef] <asn:2> *addr
   drivers/usb/cdns3/drd.c:45:42: sparse:    got restricted __le32 *
   drivers/usb/cdns3/drd.c:47:42: sparse: sparse: incorrect type in argument 1 (different address spaces) @@    expected void const volatile [noderef] <asn:2> *addr @@    got [noderef] <asn:2> *addr @@
   drivers/usb/cdns3/drd.c:47:42: sparse:    expected void const volatile [noderef] <asn:2> *addr
   drivers/usb/cdns3/drd.c:47:42: sparse:    got restricted __le32 *
   drivers/usb/cdns3/drd.c:49:42: sparse: sparse: incorrect type in argument 2 (different address spaces) @@    expected void volatile [noderef] <asn:2> *addr @@    got [noderef] <asn:2> *addr @@
   drivers/usb/cdns3/drd.c:49:42: sparse:    expected void volatile [noderef] <asn:2> *addr
   drivers/usb/cdns3/drd.c:49:42: sparse:    got restricted __le32 *
   drivers/usb/cdns3/drd.c:71:25: sparse: sparse: incorrect type in argument 1 (different address spaces) @@    expected void const volatile [noderef] <asn:2> *addr @@    got [noderef] <asn:2> *addr @@
   drivers/usb/cdns3/drd.c:71:25: sparse:    expected void const volatile [noderef] <asn:2> *addr
   drivers/usb/cdns3/drd.c:71:25: sparse:    got restricted __le32 *
   drivers/usb/cdns3/drd.c:81:30: sparse: sparse: incorrect type in argument 1 (different address spaces) @@    expected void const volatile [noderef] <asn:2> *addr @@    got [noderef] <asn:2> *addr @@
   drivers/usb/cdns3/drd.c:81:30: sparse:    expected void const volatile [noderef] <asn:2> *addr
   drivers/usb/cdns3/drd.c:81:30: sparse:    got restricted __le32 *
   drivers/usb/cdns3/drd.c:114:24: sparse: sparse: incorrect type in argument 2 (different address spaces) @@    expected void volatile [noderef] <asn:2> *addr @@    got [noderef] <asn:2> *addr @@
   drivers/usb/cdns3/drd.c:114:24: sparse:    expected void volatile [noderef] <asn:2> *addr
   drivers/usb/cdns3/drd.c:114:24: sparse:    got restricted __le32 *
   drivers/usb/cdns3/drd.c:124:48: sparse: sparse: incorrect type in argument 2 (different address spaces) @@    expected void volatile [noderef] <asn:2> *addr @@    got [noderef] <asn:2> *addr @@
   drivers/usb/cdns3/drd.c:124:48: sparse:    expected void volatile [noderef] <asn:2> *addr
   drivers/usb/cdns3/drd.c:124:48: sparse:    got restricted __le32 *
   drivers/usb/cdns3/drd.c:141:56: sparse: sparse: incorrect type in argument 2 (different address spaces) @@    expected void volatile [noderef] <asn:2> *addr @@    got [noderef] <asn:2> *addr @@
   drivers/usb/cdns3/drd.c:141:56: sparse:    expected void volatile [noderef] <asn:2> *addr
   drivers/usb/cdns3/drd.c:141:56: sparse:    got restricted __le32 *
   drivers/usb/cdns3/drd.c:144:23: sparse: sparse: incorrect type in argument 1 (different address spaces) @@    expected void const volatile [noderef] <asn:2> *addr @@    got [noderef] <asn:2> *addr @@
   drivers/usb/cdns3/drd.c:144:23: sparse:    expected void const volatile [noderef] <asn:2> *addr
   drivers/usb/cdns3/drd.c:144:23: sparse:    got restricted __le32 *
   drivers/usb/cdns3/drd.c:144:23: sparse: sparse: incorrect type in argument 1 (different address spaces) @@    expected void const volatile [noderef] <asn:2> *addr @@    got [noderef] <asn:2> *addr @@
   drivers/usb/cdns3/drd.c:144:23: sparse:    expected void const volatile [noderef] <asn:2> *addr
   drivers/usb/cdns3/drd.c:144:23: sparse:    got restricted __le32 *
   drivers/usb/cdns3/drd.c:154:29: sparse: sparse: incorrect type in argument 2 (different address spaces) @@    expected void volatile [noderef] <asn:2> *addr @@    got [noderef] <asn:2> *addr @@
   drivers/usb/cdns3/drd.c:154:29: sparse:    expected void volatile [noderef] <asn:2> *addr
   drivers/usb/cdns3/drd.c:154:29: sparse:    got restricted __le32 *
   drivers/usb/cdns3/drd.c:156:17: sparse: sparse: incorrect type in argument 1 (different address spaces) @@    expected void const volatile [noderef] <asn:2> *addr @@    got [noderef] <asn:2> *addr @@
   drivers/usb/cdns3/drd.c:156:17: sparse:    expected void const volatile [noderef] <asn:2> *addr
   drivers/usb/cdns3/drd.c:156:17: sparse:    got restricted __le32 *
   drivers/usb/cdns3/drd.c:156:17: sparse: sparse: incorrect type in argument 1 (different address spaces) @@    expected void const volatile [noderef] <asn:2> *addr @@    got [noderef] <asn:2> *addr @@
   drivers/usb/cdns3/drd.c:156:17: sparse:    expected void const volatile [noderef] <asn:2> *addr
   drivers/usb/cdns3/drd.c:156:17: sparse:    got restricted __le32 *
   drivers/usb/cdns3/drd.c:178:55: sparse: sparse: incorrect type in argument 2 (different address spaces) @@    expected void volatile [noderef] <asn:2> *addr @@    got [noderef] <asn:2> *addr @@
   drivers/usb/cdns3/drd.c:178:55: sparse:    expected void volatile [noderef] <asn:2> *addr
   drivers/usb/cdns3/drd.c:178:55: sparse:    got restricted __le32 *
   drivers/usb/cdns3/drd.c:182:23: sparse: sparse: incorrect type in argument 1 (different address spaces) @@    expected void const volatile [noderef] <asn:2> *addr @@    got [noderef] <asn:2> *addr @@
   drivers/usb/cdns3/drd.c:182:23: sparse:    expected void const volatile [noderef] <asn:2> *addr
   drivers/usb/cdns3/drd.c:182:23: sparse:    got restricted __le32 *
   drivers/usb/cdns3/drd.c:182:23: sparse: sparse: incorrect type in argument 1 (different address spaces) @@    expected void const volatile [noderef] <asn:2> *addr @@    got [noderef] <asn:2> *addr @@
   drivers/usb/cdns3/drd.c:182:23: sparse:    expected void const volatile [noderef] <asn:2> *addr
   drivers/usb/cdns3/drd.c:182:23: sparse:    got restricted __le32 *
   drivers/usb/cdns3/drd.c:197:29: sparse: sparse: incorrect type in argument 2 (different address spaces) @@    expected void volatile [noderef] <asn:2> *addr @@    got [noderef] <asn:2> *addr @@
   drivers/usb/cdns3/drd.c:197:29: sparse:    expected void volatile [noderef] <asn:2> *addr
   drivers/usb/cdns3/drd.c:197:29: sparse:    got restricted __le32 *
   drivers/usb/cdns3/drd.c:199:17: sparse: sparse: incorrect type in argument 1 (different address spaces) @@    expected void const volatile [noderef] <asn:2> *addr @@    got [noderef] <asn:2> *addr @@
   drivers/usb/cdns3/drd.c:199:17: sparse:    expected void const volatile [noderef] <asn:2> *addr
   drivers/usb/cdns3/drd.c:199:17: sparse:    got restricted __le32 *
   drivers/usb/cdns3/drd.c:199:17: sparse: sparse: incorrect type in argument 1 (different address spaces) @@    expected void const volatile [noderef] <asn:2> *addr @@    got [noderef] <asn:2> *addr @@
   drivers/usb/cdns3/drd.c:199:17: sparse:    expected void const volatile [noderef] <asn:2> *addr
   drivers/usb/cdns3/drd.c:199:17: sparse:    got restricted __le32 *
   drivers/usb/cdns3/drd.c:219:25: sparse: sparse: incorrect type in argument 2 (different address spaces) @@    expected void volatile [noderef] <asn:2> *addr @@    got [noderef] <asn:2> *addr @@
   drivers/usb/cdns3/drd.c:219:25: sparse:    expected void volatile [noderef] <asn:2> *addr
   drivers/usb/cdns3/drd.c:219:25: sparse:    got restricted __le32 *
   drivers/usb/cdns3/drd.c:284:26: sparse: sparse: incorrect type in argument 1 (different address spaces) @@    expected void const volatile [noderef] <asn:2> *addr @@    got [noderef] <asn:2> *addr @@
   drivers/usb/cdns3/drd.c:284:26: sparse:    expected void const volatile [noderef] <asn:2> *addr
   drivers/usb/cdns3/drd.c:284:26: sparse:    got restricted __le32 *
   drivers/usb/cdns3/drd.c:303:25: sparse: sparse: incorrect type in argument 2 (different address spaces) @@    expected void volatile [noderef] <asn:2> *addr @@    got [noderef] <asn:2> *addr @@
   drivers/usb/cdns3/drd.c:303:25: sparse:    expected void volatile [noderef] <asn:2> *addr
   drivers/usb/cdns3/drd.c:303:25: sparse:    got restricted __le32 *
>> drivers/usb/cdns3/drd.c:326:27: sparse: sparse: incorrect type in assignment (different address spaces) @@    expected struct cdns3_otg_legacy_regs *otg_v0_regs @@    got void struct cdns3_otg_legacy_regs *otg_v0_regs @@
>> drivers/usb/cdns3/drd.c:326:27: sparse:    expected struct cdns3_otg_legacy_regs *otg_v0_regs
>> drivers/usb/cdns3/drd.c:326:27: sparse:    got void [noderef] <asn:2> *[assigned] regs
   drivers/usb/cdns3/drd.c:327:25: sparse: sparse: incorrect type in argument 1 (different address spaces) @@    expected void const volatile [noderef] <asn:2> *addr @@    got [noderef] <asn:2> *addr @@
   drivers/usb/cdns3/drd.c:327:25: sparse:    expected void const volatile [noderef] <asn:2> *addr
   drivers/usb/cdns3/drd.c:327:25: sparse:    got restricted __le32 *
>> drivers/usb/cdns3/drd.c:330:32: sparse: sparse: incorrect type in assignment (different address spaces) @@    expected struct cdns3_otg_common_regs *otg_regs @@    got void struct cdns3_otg_common_regs *otg_regs @@
>> drivers/usb/cdns3/drd.c:330:32: sparse:    expected struct cdns3_otg_common_regs *otg_regs
   drivers/usb/cdns3/drd.c:330:32: sparse:    got void [noderef] <asn:2> *[assigned] regs
   drivers/usb/cdns3/drd.c:331:32: sparse: sparse: incorrect type in argument 2 (different address spaces) @@    expected void volatile [noderef] <asn:2> *addr @@    got [noderef] <asn:2> *addr @@
   drivers/usb/cdns3/drd.c:331:32: sparse:    expected void volatile [noderef] <asn:2> *addr
   drivers/usb/cdns3/drd.c:331:32: sparse:    got restricted __le32 *
   drivers/usb/cdns3/drd.c:332:17: sparse: sparse: incorrect type in argument 1 (different address spaces) @@    expected void const volatile [noderef] <asn:2> *addr @@    got [noderef] <asn:2> *addr @@
   drivers/usb/cdns3/drd.c:332:17: sparse:    expected void const volatile [noderef] <asn:2> *addr
   drivers/usb/cdns3/drd.c:332:17: sparse:    got restricted __le32 *
>> drivers/usb/cdns3/drd.c:336:35: sparse: sparse: incorrect type in assignment (different address spaces) @@    expected struct cdns3_otg_regs *otg_v1_regs @@    got void [noderestruct cdns3_otg_regs *otg_v1_regs @@
>> drivers/usb/cdns3/drd.c:336:35: sparse:    expected struct cdns3_otg_regs *otg_v1_regs
   drivers/usb/cdns3/drd.c:336:35: sparse:    got void [noderef] <asn:2> *[assigned] regs
   drivers/usb/cdns3/drd.c:339:32: sparse: sparse: incorrect type in argument 2 (different address spaces) @@    expected void volatile [noderef] <asn:2> *addr @@    got [noderef] <asn:2> *addr @@
   drivers/usb/cdns3/drd.c:339:32: sparse:    expected void volatile [noderef] <asn:2> *addr
   drivers/usb/cdns3/drd.c:339:32: sparse:    got restricted __le32 *
   drivers/usb/cdns3/drd.c:340:17: sparse: sparse: incorrect type in argument 1 (different address spaces) @@    expected void const volatile [noderef] <asn:2> *addr @@    got [noderef] <asn:2> *addr @@
   drivers/usb/cdns3/drd.c:340:17: sparse:    expected void const volatile [noderef] <asn:2> *addr
   drivers/usb/cdns3/drd.c:340:17: sparse:    got restricted __le32 *
   drivers/usb/cdns3/drd.c:340:17: sparse: sparse: incorrect type in argument 1 (different address spaces) @@    expected void const volatile [noderef] <asn:2> *addr @@    got [noderef] <asn:2> *addr @@
   drivers/usb/cdns3/drd.c:340:17: sparse:    expected void const volatile [noderef] <asn:2> *addr
   drivers/usb/cdns3/drd.c:340:17: sparse:    got restricted __le32 *
   drivers/usb/cdns3/drd.c:345:17: sparse: sparse: incorrect type in argument 1 (different address spaces) @@    expected void const volatile [noderef] <asn:2> *addr @@    got [noderef] <asn:2> *addr @@
   drivers/usb/cdns3/drd.c:345:17: sparse:    expected void const volatile [noderef] <asn:2> *addr
   drivers/usb/cdns3/drd.c:345:17: sparse:    got restricted __le32 *
   drivers/usb/cdns3/drd.c:368:28: sparse: sparse: incorrect type in argument 1 (different address spaces) @@    expected void const volatile [noderef] <asn:2> *addr @@    got [noderef] <asn:2> *addr @@
   drivers/usb/cdns3/drd.c:368:28: sparse:    expected void const volatile [noderef] <asn:2> *addr
   drivers/usb/cdns3/drd.c:368:28: sparse:    got restricted __le32 *
--
>> drivers/usb/cdns3/gadget.c:1157:35: sparse: sparse: incorrect type in assignment (different base types) @@    expected restricted __le32 [usertype] control @@    got 2 [usertype] control @@
>> drivers/usb/cdns3/gadget.c:1157:35: sparse:    expected restricted __le32 [usertype] control
>> drivers/usb/cdns3/gadget.c:1157:35: sparse:    got unsigned long
>> drivers/usb/cdns3/gadget.c:1173:29: sparse: sparse: incorrect type in assignment (different base types) @@    expected restricted __le32 [usertype] buffer @@    got __le32 [usertype] buffer @@
>> drivers/usb/cdns3/gadget.c:1173:29: sparse:    expected restricted __le32 [usertype] buffer
>> drivers/usb/cdns3/gadget.c:1173:29: sparse:    got unsigned long long
>> drivers/usb/cdns3/gadget.c:1188:29: sparse: sparse: incorrect type in assignment (different base types) @@    expected restricted __le32 [usertype] length @@    got 2 [usertype] length @@
>> drivers/usb/cdns3/gadget.c:1188:29: sparse:    expected restricted __le32 [usertype] length
   drivers/usb/cdns3/gadget.c:1188:29: sparse:    got unsigned long
>> drivers/usb/cdns3/gadget.c:1191:37: sparse: sparse: invalid assignment: |=
>> drivers/usb/cdns3/gadget.c:1191:37: sparse:    left side has type restricted __le32
>> drivers/usb/cdns3/gadget.c:1191:37: sparse:    right side has type unsigned long
>> drivers/usb/cdns3/gadget.c:1213:38: sparse: sparse: incorrect type in assignment (different base types) @@    expected restricted __le32 [usertype] control @@    got unsignrestricted __le32 [usertype] control @@
   drivers/usb/cdns3/gadget.c:1213:38: sparse:    expected restricted __le32 [usertype] control
>> drivers/usb/cdns3/gadget.c:1213:38: sparse:    got unsigned int [assigned] [usertype] control
   drivers/usb/cdns3/gadget.c:1215:48: sparse: sparse: incorrect type in assignment (different base types) @@    expected restricted __le32 [usertype] control @@    got unsignrestricted __le32 [usertype] control @@
   drivers/usb/cdns3/gadget.c:1215:48: sparse:    expected restricted __le32 [usertype] control
   drivers/usb/cdns3/gadget.c:1215:48: sparse:    got unsigned int [assigned] [usertype] control
   drivers/usb/cdns3/gadget.c:1229:30: sparse: sparse: invalid assignment: |=
   drivers/usb/cdns3/gadget.c:1229:30: sparse:    left side has type restricted __le32
   drivers/usb/cdns3/gadget.c:1229:30: sparse:    right side has type unsigned long
>> drivers/usb/cdns3/gadget.c:1255:36: sparse: sparse: restricted __le32 degrades to integer
   drivers/usb/cdns3/gadget.c:1255:30: sparse: sparse: incorrect type in assignment (different base types) @@    expected restricted __le32 [usertype] control @@    got  [usertype] control @@
   drivers/usb/cdns3/gadget.c:1255:30: sparse:    expected restricted __le32 [usertype] control
>> drivers/usb/cdns3/gadget.c:1255:30: sparse:    got unsigned int
   drivers/usb/cdns3/gadget.c:1010:29: sparse: sparse: incorrect type in assignment (different base types) @@    expected restricted __le32 [usertype] buffer @@    got __le32 [usertype] buffer @@
   drivers/usb/cdns3/gadget.c:1010:29: sparse:    expected restricted __le32 [usertype] buffer
   drivers/usb/cdns3/gadget.c:1010:29: sparse:    got unsigned long long
   drivers/usb/cdns3/gadget.c:1013:29: sparse: sparse: incorrect type in assignment (different base types) @@    expected restricted __le32 [usertype] buffer @@    got __le32 [usertype] buffer @@
   drivers/usb/cdns3/gadget.c:1013:29: sparse:    expected restricted __le32 [usertype] buffer
   drivers/usb/cdns3/gadget.c:1013:29: sparse:    got unsigned long long
   drivers/usb/cdns3/gadget.c:1019:21: sparse: sparse: incorrect type in assignment (different base types) @@    expected restricted __le32 [usertype] length @@    got 2 [usertype] length @@
   drivers/usb/cdns3/gadget.c:1019:21: sparse:    expected restricted __le32 [usertype] length
   drivers/usb/cdns3/gadget.c:1019:21: sparse:    got unsigned long
   drivers/usb/cdns3/gadget.c:1029:37: sparse: sparse: invalid assignment: |=
   drivers/usb/cdns3/gadget.c:1029:37: sparse:    left side has type restricted __le32
   drivers/usb/cdns3/gadget.c:1029:37: sparse:    right side has type unsigned long
   drivers/usb/cdns3/gadget.c:1033:22: sparse: sparse: incorrect type in assignment (different base types) @@    expected restricted __le32 [usertype] control @@    got unsignrestricted __le32 [usertype] control @@
   drivers/usb/cdns3/gadget.c:1033:22: sparse:    expected restricted __le32 [usertype] control
   drivers/usb/cdns3/gadget.c:1033:22: sparse:    got unsigned int [assigned] [usertype] control
>> drivers/usb/cdns3/gadget.c:85:6: sparse: sparse: symbol 'cdns3_clear_register_bit' was not declared. Should it be static?
>> drivers/usb/cdns3/gadget.c:140:26: sparse: sparse: symbol 'cdns3_next_align_buf' was not declared. Should it be static?
>> drivers/usb/cdns3/gadget.c:151:22: sparse: sparse: symbol 'cdns3_next_priv_request' was not declared. Should it be static?
>> drivers/usb/cdns3/gadget.c:193:5: sparse: sparse: symbol 'cdns3_ring_size' was not declared. Should it be static?
   drivers/usb/cdns3/gadget.c:263:34: sparse: sparse: incorrect type in assignment (different base types) @@    expected restricted __le32 [usertype] buffer @@    got __le32 [usertype] buffer @@
   drivers/usb/cdns3/gadget.c:263:34: sparse:    expected restricted __le32 [usertype] buffer
   drivers/usb/cdns3/gadget.c:263:34: sparse:    got unsigned long long
   drivers/usb/cdns3/gadget.c:264:35: sparse: sparse: incorrect type in assignment (different base types) @@    expected restricted __le32 [usertype] control @@    got 2 [usertype] control @@
   drivers/usb/cdns3/gadget.c:264:35: sparse:    expected restricted __le32 [usertype] control
   drivers/usb/cdns3/gadget.c:264:35: sparse:    got unsigned long
>> drivers/usb/cdns3/gadget.c:348:6: sparse: sparse: symbol 'cdns3_move_deq_to_next_trb' was not declared. Should it be static?
>> drivers/usb/cdns3/gadget.c:514:20: sparse: sparse: symbol 'cdns3_wa2_gadget_giveback' was not declared. Should it be static?
>> drivers/usb/cdns3/gadget.c:554:5: sparse: sparse: symbol 'cdns3_wa2_gadget_ep_queue' was not declared. Should it be static?
   drivers/usb/cdns3/gadget.c:849:49: sparse: sparse: restricted __le32 degrades to integer
   drivers/usb/cdns3/gadget.c:848:51: sparse: sparse: incorrect type in assignment (different base types) @@    expected restricted __le32 [usertype] control @@    got  [usertype] control @@
   drivers/usb/cdns3/gadget.c:848:51: sparse:    expected restricted __le32 [usertype] control
   drivers/usb/cdns3/gadget.c:848:51: sparse:    got unsigned int
   drivers/usb/cdns3/gadget.c:852:49: sparse: sparse: restricted __le32 degrades to integer
   drivers/usb/cdns3/gadget.c:851:51: sparse: sparse: incorrect type in assignment (different base types) @@    expected restricted __le32 [usertype] control @@    got  [usertype] control @@
   drivers/usb/cdns3/gadget.c:851:51: sparse:    expected restricted __le32 [usertype] control
   drivers/usb/cdns3/gadget.c:851:51: sparse:    got unsigned int
>> drivers/usb/cdns3/gadget.c:839:6: sparse: sparse: symbol 'cdns3_wa1_restore_cycle_bit' was not declared. Should it be static?
   drivers/usb/cdns3/gadget.c:1393:17: sparse: sparse: restricted __le32 degrades to integer
   drivers/usb/cdns3/gadget.c:1442:21: sparse: sparse: restricted __le32 degrades to integer
>> drivers/usb/cdns3/gadget.c:1574:35: sparse: sparse: dubious: x | !y
>> drivers/usb/cdns3/gadget.c:1907:6: sparse: sparse: symbol 'cdns3_stream_ep_reconfig' was not declared. Should it be static?
>> drivers/usb/cdns3/gadget.c:1928:6: sparse: sparse: symbol 'cdns3_configure_dmult' was not declared. Should it be static?
   drivers/usb/cdns3/gadget.c:2552:34: sparse: sparse: incorrect type in assignment (different base types) @@    expected restricted __le32 [usertype] buffer @@    got __le32 [usertype] buffer @@
   drivers/usb/cdns3/gadget.c:2552:34: sparse:    expected restricted __le32 [usertype] buffer
   drivers/usb/cdns3/gadget.c:2552:34: sparse:    got unsigned long long
   drivers/usb/cdns3/gadget.c:2554:46: sparse: sparse: restricted __le32 degrades to integer
   drivers/usb/cdns3/gadget.c:2554:35: sparse: sparse: incorrect type in assignment (different base types) @@    expected restricted __le32 [usertype] control @@    got 2 [usertype] control @@
   drivers/usb/cdns3/gadget.c:2554:35: sparse:    expected restricted __le32 [usertype] control
   drivers/usb/cdns3/gadget.c:2554:35: sparse:    got unsigned long
   drivers/usb/cdns3/gadget.c:2610:43: sparse: sparse: restricted __le32 degrades to integer
   drivers/usb/cdns3/gadget.c:2610:38: sparse: sparse: incorrect type in assignment (different base types) @@    expected restricted __le32 [usertype] control @@    got 2 [usertype] control @@
   drivers/usb/cdns3/gadget.c:2610:38: sparse:    expected restricted __le32 [usertype] control
   drivers/usb/cdns3/gadget.c:2610:38: sparse:    got unsigned long
   drivers/usb/cdns3/gadget.c:2625:43: sparse: sparse: restricted __le32 degrades to integer
   drivers/usb/cdns3/gadget.c:2625:38: sparse: sparse: incorrect type in assignment (different base types) @@    expected restricted __le32 [usertype] control @@    got 2 [usertype] control @@
   drivers/usb/cdns3/gadget.c:2625:38: sparse:    expected restricted __le32 [usertype] control
   drivers/usb/cdns3/gadget.c:2625:38: sparse:    got unsigned long
--
>> drivers/usb/cdns3/ep0.c:40:37: sparse: sparse: incorrect type in assignment (different base types) @@    expected restricted __le32 [usertype] buffer @@    got __le32 [usertype] buffer @@
>> drivers/usb/cdns3/ep0.c:40:37: sparse:    expected restricted __le32 [usertype] buffer
>> drivers/usb/cdns3/ep0.c:40:37: sparse:    got unsigned long long
>> drivers/usb/cdns3/ep0.c:41:37: sparse: sparse: incorrect type in assignment (different base types) @@    expected restricted __le32 [usertype] length @@    got 2 [usertype] length @@
>> drivers/usb/cdns3/ep0.c:41:37: sparse:    expected restricted __le32 [usertype] length
>> drivers/usb/cdns3/ep0.c:41:37: sparse:    got unsigned long
>> drivers/usb/cdns3/ep0.c:44:46: sparse: sparse: incorrect type in assignment (different base types) @@    expected restricted __le32 [usertype] control @@    got 2 [usertype] control @@
>> drivers/usb/cdns3/ep0.c:44:46: sparse:    expected restricted __le32 [usertype] control
   drivers/usb/cdns3/ep0.c:44:46: sparse:    got unsigned long
   drivers/usb/cdns3/ep0.c:45:45: sparse: sparse: incorrect type in assignment (different base types) @@    expected restricted __le32 [usertype] buffer @@    got __le32 [usertype] buffer @@
   drivers/usb/cdns3/ep0.c:45:45: sparse:    expected restricted __le32 [usertype] buffer
   drivers/usb/cdns3/ep0.c:45:45: sparse:    got unsigned long long
   drivers/usb/cdns3/ep0.c:46:45: sparse: sparse: incorrect type in assignment (different base types) @@    expected restricted __le32 [usertype] length @@    got 2 [usertype] length @@
   drivers/usb/cdns3/ep0.c:46:45: sparse:    expected restricted __le32 [usertype] length
   drivers/usb/cdns3/ep0.c:46:45: sparse:    got unsigned long
   drivers/usb/cdns3/ep0.c:47:46: sparse: sparse: incorrect type in assignment (different base types) @@    expected restricted __le32 [usertype] control @@    got 2 [usertype] control @@
   drivers/usb/cdns3/ep0.c:47:46: sparse:    expected restricted __le32 [usertype] control
   drivers/usb/cdns3/ep0.c:47:46: sparse:    got unsigned long
   drivers/usb/cdns3/ep0.c:50:46: sparse: sparse: incorrect type in assignment (different base types) @@    expected restricted __le32 [usertype] control @@    got 2 [usertype] control @@
   drivers/usb/cdns3/ep0.c:50:46: sparse:    expected restricted __le32 [usertype] control
   drivers/usb/cdns3/ep0.c:50:46: sparse:    got unsigned long
>> drivers/usb/cdns3/ep0.c:267:52: sparse: sparse: incorrect type in argument 1 (different base types) @@    expected unsigned char [usertype] ep_addr @@    got restunsigned char [usertype] ep_addr @@
>> drivers/usb/cdns3/ep0.c:267:52: sparse:    expected unsigned char [usertype] ep_addr
>> drivers/usb/cdns3/ep0.c:267:52: sparse:    got restricted __le16 [usertype] wIndex
>> drivers/usb/cdns3/ep0.c:271:47: sparse: sparse: incorrect type in argument 2 (different base types) @@    expected unsigned int [usertype] ep @@    got restrunsigned int [usertype] ep @@
>> drivers/usb/cdns3/ep0.c:271:47: sparse:    expected unsigned int [usertype] ep
   drivers/usb/cdns3/ep0.c:271:47: sparse:    got restricted __le16 [usertype] wIndex
>> drivers/usb/cdns3/ep0.c:387:19: sparse: sparse: restricted __le16 degrades to integer
   drivers/usb/cdns3/ep0.c:390:44: sparse: sparse: incorrect type in argument 1 (different base types) @@    expected unsigned char [usertype] ep_addr @@    got restunsigned char [usertype] ep_addr @@
   drivers/usb/cdns3/ep0.c:390:44: sparse:    expected unsigned char [usertype] ep_addr
   drivers/usb/cdns3/ep0.c:390:44: sparse:    got restricted __le16 [usertype] wIndex
   drivers/usb/cdns3/ep0.c:393:39: sparse: sparse: incorrect type in argument 2 (different base types) @@    expected unsigned int [usertype] ep @@    got restrunsigned int [usertype] ep @@
   drivers/usb/cdns3/ep0.c:393:39: sparse:    expected unsigned int [usertype] ep
   drivers/usb/cdns3/ep0.c:393:39: sparse:    got restricted __le16 [usertype] wIndex
   drivers/usb/cdns3/ep0.c:454:21: sparse: sparse: restricted __le16 degrades to integer
>> drivers/usb/cdns3/ep0.c:478:31: sparse: sparse: incorrect type in assignment (different base types) @@    expected unsigned short [usertype] isoch_delay @@    got resunsigned short [usertype] isoch_delay @@
>> drivers/usb/cdns3/ep0.c:478:31: sparse:    expected unsigned short [usertype] isoch_delay
>> drivers/usb/cdns3/ep0.c:478:31: sparse:    got restricted __le16 [usertype] wValue
--
>> drivers/usb/cdns3/./trace.h:392:1: sparse: sparse: incorrect type in assignment (different base types) @@    expected unsigned int [usertype] buffer @@    got restrunsigned int [usertype] buffer @@
>> drivers/usb/cdns3/./trace.h:392:1: sparse:    expected unsigned int [usertype] buffer
>> drivers/usb/cdns3/./trace.h:392:1: sparse:    got restricted __le32 [usertype] buffer
>> drivers/usb/cdns3/./trace.h:392:1: sparse: sparse: incorrect type in assignment (different base types) @@    expected unsigned int [usertype] length @@    got restrunsigned int [usertype] length @@
>> drivers/usb/cdns3/./trace.h:392:1: sparse:    expected unsigned int [usertype] length
>> drivers/usb/cdns3/./trace.h:392:1: sparse:    got restricted __le32 [usertype] length
>> drivers/usb/cdns3/./trace.h:392:1: sparse: sparse: incorrect type in assignment (different base types) @@    expected unsigned int [usertype] control @@    got restrunsigned int [usertype] control @@
>> drivers/usb/cdns3/./trace.h:392:1: sparse:    expected unsigned int [usertype] control
>> drivers/usb/cdns3/./trace.h:392:1: sparse:    got restricted __le32 [usertype] control
>> drivers/usb/cdns3/./trace.h:392:1: sparse: sparse: incorrect type in assignment (different base types) @@    expected unsigned int [usertype] buffer @@    got restrunsigned int [usertype] buffer @@
>> drivers/usb/cdns3/./trace.h:392:1: sparse:    expected unsigned int [usertype] buffer
>> drivers/usb/cdns3/./trace.h:392:1: sparse:    got restricted __le32 [usertype] buffer
>> drivers/usb/cdns3/./trace.h:392:1: sparse: sparse: incorrect type in assignment (different base types) @@    expected unsigned int [usertype] length @@    got restrunsigned int [usertype] length @@
>> drivers/usb/cdns3/./trace.h:392:1: sparse:    expected unsigned int [usertype] length
>> drivers/usb/cdns3/./trace.h:392:1: sparse:    got restricted __le32 [usertype] length
>> drivers/usb/cdns3/./trace.h:392:1: sparse: sparse: incorrect type in assignment (different base types) @@    expected unsigned int [usertype] control @@    got restrunsigned int [usertype] control @@
>> drivers/usb/cdns3/./trace.h:392:1: sparse:    expected unsigned int [usertype] control
>> drivers/usb/cdns3/./trace.h:392:1: sparse:    got restricted __le32 [usertype] control

Please review and possibly fold the followup patch.

vim +43 drivers/usb/cdns3/drd.c

7733f6c32e36ff Pawel Laszczak 2019-08-26  22  
7733f6c32e36ff Pawel Laszczak 2019-08-26  23  /**
7733f6c32e36ff Pawel Laszczak 2019-08-26  24   * cdns3_set_mode - change mode of OTG Core
7733f6c32e36ff Pawel Laszczak 2019-08-26  25   * @cdns: pointer to context structure
7733f6c32e36ff Pawel Laszczak 2019-08-26  26   * @mode: selected mode from cdns_role
7733f6c32e36ff Pawel Laszczak 2019-08-26  27   *
7733f6c32e36ff Pawel Laszczak 2019-08-26  28   * Returns 0 on success otherwise negative errno
7733f6c32e36ff Pawel Laszczak 2019-08-26  29   */
7733f6c32e36ff Pawel Laszczak 2019-08-26  30  int cdns3_set_mode(struct cdns3 *cdns, enum usb_dr_mode mode)
7733f6c32e36ff Pawel Laszczak 2019-08-26  31  {
7733f6c32e36ff Pawel Laszczak 2019-08-26  32  	int ret = 0;
7733f6c32e36ff Pawel Laszczak 2019-08-26  33  	u32 reg;
7733f6c32e36ff Pawel Laszczak 2019-08-26  34  
7733f6c32e36ff Pawel Laszczak 2019-08-26  35  	switch (mode) {
7733f6c32e36ff Pawel Laszczak 2019-08-26  36  	case USB_DR_MODE_PERIPHERAL:
7733f6c32e36ff Pawel Laszczak 2019-08-26  37  		break;
7733f6c32e36ff Pawel Laszczak 2019-08-26  38  	case USB_DR_MODE_HOST:
7733f6c32e36ff Pawel Laszczak 2019-08-26  39  		break;
7733f6c32e36ff Pawel Laszczak 2019-08-26  40  	case USB_DR_MODE_OTG:
7733f6c32e36ff Pawel Laszczak 2019-08-26  41  		dev_dbg(cdns->dev, "Set controller to OTG mode\n");
7733f6c32e36ff Pawel Laszczak 2019-08-26  42  		if (cdns->version == CDNS3_CONTROLLER_V1) {
7733f6c32e36ff Pawel Laszczak 2019-08-26 @43  			reg = readl(&cdns->otg_v1_regs->override);
7733f6c32e36ff Pawel Laszczak 2019-08-26  44  			reg |= OVERRIDE_IDPULLUP;
7733f6c32e36ff Pawel Laszczak 2019-08-26 @45  			writel(reg, &cdns->otg_v1_regs->override);
7733f6c32e36ff Pawel Laszczak 2019-08-26  46  		} else {
7733f6c32e36ff Pawel Laszczak 2019-08-26  47  			reg = readl(&cdns->otg_v0_regs->ctrl1);
7733f6c32e36ff Pawel Laszczak 2019-08-26  48  			reg |= OVERRIDE_IDPULLUP_V0;
7733f6c32e36ff Pawel Laszczak 2019-08-26  49  			writel(reg, &cdns->otg_v0_regs->ctrl1);
7733f6c32e36ff Pawel Laszczak 2019-08-26  50  		}
7733f6c32e36ff Pawel Laszczak 2019-08-26  51  
7733f6c32e36ff Pawel Laszczak 2019-08-26  52  		/*
7733f6c32e36ff Pawel Laszczak 2019-08-26  53  		 * Hardware specification says: "ID_VALUE must be valid within
7733f6c32e36ff Pawel Laszczak 2019-08-26  54  		 * 50ms after idpullup is set to '1" so driver must wait
7733f6c32e36ff Pawel Laszczak 2019-08-26  55  		 * 50ms before reading this pin.
7733f6c32e36ff Pawel Laszczak 2019-08-26  56  		 */
7733f6c32e36ff Pawel Laszczak 2019-08-26  57  		usleep_range(50000, 60000);
7733f6c32e36ff Pawel Laszczak 2019-08-26  58  		break;
7733f6c32e36ff Pawel Laszczak 2019-08-26  59  	default:
7733f6c32e36ff Pawel Laszczak 2019-08-26  60  		dev_err(cdns->dev, "Unsupported mode of operation %d\n", mode);
7733f6c32e36ff Pawel Laszczak 2019-08-26  61  		return -EINVAL;
7733f6c32e36ff Pawel Laszczak 2019-08-26  62  	}
7733f6c32e36ff Pawel Laszczak 2019-08-26  63  
7733f6c32e36ff Pawel Laszczak 2019-08-26  64  	return ret;
7733f6c32e36ff Pawel Laszczak 2019-08-26  65  }
7733f6c32e36ff Pawel Laszczak 2019-08-26  66  

:::::: The code at line 43 was first introduced by commit
:::::: 7733f6c32e36ff9d7adadf40001039bf219b1cbe usb: cdns3: Add Cadence USB3 DRD Driver

:::::: TO: Pawel Laszczak <pawell@cadence.com>
:::::: CC: Felipe Balbi <felipe.balbi@linux.intel.com>

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
Greg Kroah-Hartman March 26, 2020, 1:04 p.m. UTC | #3
On Thu, Mar 26, 2020 at 08:28:58PM +0800, kbuild test robot wrote:
> 
> Fixes: 87db1192dc33 ("usb: cdns3: make signed 1 bit bitfields unsigned")

This original patch did not "cause" this problem, it's just that you for
some reason ran sparse for the first time on the file.

So I can't take this as-is, can you remove this line and resend?

thanks,

greg k-h
Chen, Rong A March 27, 2020, 12:34 a.m. UTC | #4
On 3/26/20 9:04 PM, Greg Kroah-Hartman wrote:
> On Thu, Mar 26, 2020 at 08:28:58PM +0800, kbuild test robot wrote:
>> Fixes: 87db1192dc33 ("usb: cdns3: make signed 1 bit bitfields unsigned")
> This original patch did not "cause" this problem, it's just that you for
> some reason ran sparse for the first time on the file.
>
> So I can't take this as-is, can you remove this line and resend?

Hi Greg,

Sorry for the inconvenience, the patch was generated by the bot,
we'll check and resend it.

Best Regards,
Rong Chen

>
> thanks,
>
> greg k-h
> _______________________________________________
> kbuild-all mailing list -- kbuild-all@lists.01.org
> To unsubscribe send an email to kbuild-all-leave@lists.01.org
Greg Kroah-Hartman March 27, 2020, 6:42 a.m. UTC | #5
On Fri, Mar 27, 2020 at 08:34:52AM +0800, Rong Chen wrote:
> 
> 
> On 3/26/20 9:04 PM, Greg Kroah-Hartman wrote:
> > On Thu, Mar 26, 2020 at 08:28:58PM +0800, kbuild test robot wrote:
> > > Fixes: 87db1192dc33 ("usb: cdns3: make signed 1 bit bitfields unsigned")
> > This original patch did not "cause" this problem, it's just that you for
> > some reason ran sparse for the first time on the file.
> > 
> > So I can't take this as-is, can you remove this line and resend?
> 
> Hi Greg,
> 
> Sorry for the inconvenience, the patch was generated by the bot,
> we'll check and resend it.

It's fine that it was generated, it's a bug somewhere that thinks this
specific patch was a problem so that this generated patch fixed it.

Did you all just start running sparse on things again?

thanks,

greg k-h
Chen, Rong A March 27, 2020, 6:53 a.m. UTC | #6
On 3/27/20 2:42 PM, Greg Kroah-Hartman wrote:
> On Fri, Mar 27, 2020 at 08:34:52AM +0800, Rong Chen wrote:
>>
>> On 3/26/20 9:04 PM, Greg Kroah-Hartman wrote:
>>> On Thu, Mar 26, 2020 at 08:28:58PM +0800, kbuild test robot wrote:
>>>> Fixes: 87db1192dc33 ("usb: cdns3: make signed 1 bit bitfields unsigned")
>>> This original patch did not "cause" this problem, it's just that you for
>>> some reason ran sparse for the first time on the file.
>>>
>>> So I can't take this as-is, can you remove this line and resend?
>> Hi Greg,
>>
>> Sorry for the inconvenience, the patch was generated by the bot,
>> we'll check and resend it.
> It's fine that it was generated, it's a bug somewhere that thinks this
> specific patch was a problem so that this generated patch fixed it.
Yes, you are right, we'll fix the bug asap.

>
> Did you all just start running sparse on things again?
Sparse has been running for a long time in our system.

Best Regards,
Rong Chen

>
> thanks,
>
> greg k-h
> _______________________________________________
> kbuild-all mailing list -- kbuild-all@lists.01.org
> To unsubscribe send an email to kbuild-all-leave@lists.01.org
Chen, Rong A April 2, 2020, 1:33 a.m. UTC | #7
On 3/27/20 2:53 PM, Rong Chen wrote:
>
>
> On 3/27/20 2:42 PM, Greg Kroah-Hartman wrote:
>> On Fri, Mar 27, 2020 at 08:34:52AM +0800, Rong Chen wrote:
>>>
>>> On 3/26/20 9:04 PM, Greg Kroah-Hartman wrote:
>>>> On Thu, Mar 26, 2020 at 08:28:58PM +0800, kbuild test robot wrote:
>>>>> Fixes: 87db1192dc33 ("usb: cdns3: make signed 1 bit bitfields 
>>>>> unsigned")
>>>> This original patch did not "cause" this problem, it's just that 
>>>> you for
>>>> some reason ran sparse for the first time on the file.
>>>>
>>>> So I can't take this as-is, can you remove this line and resend?
>>> Hi Greg,
>>>
>>> Sorry for the inconvenience, the patch was generated by the bot,
>>> we'll check and resend it.
>> It's fine that it was generated, it's a bug somewhere that thinks this
>> specific patch was a problem so that this generated patch fixed it.
> Yes, you are right, we'll fix the bug asap.
>

Hi Greg,

The commit 87db1192dc33 ("usb: cdns3: make signed 1 bit bitfields 
unsigned") fixed a sparse error
which causes many sparse warnings exposed, we'll remove the wrong 
"Fixes" in our patch in future.

Best Regards,
Rong Chen
diff mbox series

Patch

diff --git a/drivers/usb/cdns3/cdns3-ti.c b/drivers/usb/cdns3/cdns3-ti.c
index c6a79ca15858..5685ba11480b 100644
--- a/drivers/usb/cdns3/cdns3-ti.c
+++ b/drivers/usb/cdns3/cdns3-ti.c
@@ -52,8 +52,8 @@  enum modestrap_mode { USBSS_MODESTRAP_MODE_NONE,
 struct cdns_ti {
 	struct device *dev;
 	void __iomem *usbss;
-	int usb2_only:1;
-	int vbus_divider:1;
+	unsigned usb2_only:1;
+	unsigned vbus_divider:1;
 	struct clk *usb2_refclk;
 	struct clk *lpm_clk;
 };
diff --git a/drivers/usb/cdns3/gadget.h b/drivers/usb/cdns3/gadget.h
index f003a7801872..bf2828e4df2c 100644
--- a/drivers/usb/cdns3/gadget.h
+++ b/drivers/usb/cdns3/gadget.h
@@ -1199,7 +1199,7 @@  struct cdns3_aligned_buf {
 	void			*buf;
 	dma_addr_t		dma;
 	u32			size;
-	int			in_use:1;
+	unsigned		in_use:1;
 	struct list_head	list;
 };
 
@@ -1308,8 +1308,8 @@  struct cdns3_device {
 	unsigned			u2_allowed:1;
 	unsigned			is_selfpowered:1;
 	unsigned			setup_pending:1;
-	int				hw_configured_flag:1;
-	int				wake_up_flag:1;
+	unsigned			hw_configured_flag:1;
+	unsigned			wake_up_flag:1;
 	unsigned			status_completion_no_call:1;
 	unsigned			using_streams:1;
 	int				out_mem_is_allocated;