Subject: [arm:cex7 11/20] drivers/net/ethernet/freescale/dpaa2/dpmac.c:67:30: sparse: sparse: incorrect type in assignment (different base types)

From: kbuild test robot <[email-masked]>
Date: Sat, 14 Sep 2019 07:14:16 +0800

tree:   git://git.armlinux.org.uk/~rmk/linux-arm.git cex7
head:   5b0bee16ea663db4aefd0cc1d0dc5e41acabb5e8
commit: 3b1e790b01fd2e3f28840734f5ced7e2083f1209 [11/20] dpaa2-mac: add PHY layer
reproduce:
        # apt-get install sparse
        # sparse version: v0.6.1-rc1-7-g2b96cd8-dirty
        git checkout 3b1e790b01fd2e3f28840734f5ced7e2083f1209
        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 <[email-masked]>

sparse warnings: (new ones prefixed by >>)

>> drivers/net/ethernet/freescale/dpaa2/dpmac.c:67:30: sparse: sparse: incorrect type in assignment (different base types) @@    expected unsigned int [usertype] dpmac_id @@    got restrunsigned int [usertype] dpmac_id @@
>> drivers/net/ethernet/freescale/dpaa2/dpmac.c:67:30: sparse:    expected unsigned int [usertype] dpmac_id
>> drivers/net/ethernet/freescale/dpaa2/dpmac.c:67:30: sparse:    got restricted __le32 [usertype]
>> drivers/net/ethernet/freescale/dpaa2/dpmac.c:139:28: sparse: sparse: incorrect type in assignment (different base types) @@    expected unsigned int [usertype] mac_id @@    got restrunsigned int [usertype] mac_id @@
>> drivers/net/ethernet/freescale/dpaa2/dpmac.c:139:28: sparse:    expected unsigned int [usertype] mac_id
   drivers/net/ethernet/freescale/dpaa2/dpmac.c:139:28: sparse:    got restricted __le32 [usertype]
   drivers/net/ethernet/freescale/dpaa2/dpmac.c:180:30: sparse: sparse: incorrect type in assignment (different base types) @@    expected unsigned int [usertype] dpmac_id @@    got restrunsigned int [usertype] dpmac_id @@
   drivers/net/ethernet/freescale/dpaa2/dpmac.c:180:30: sparse:    expected unsigned int [usertype] dpmac_id
   drivers/net/ethernet/freescale/dpaa2/dpmac.c:180:30: sparse:    got restricted __le32 [usertype]
>> drivers/net/ethernet/freescale/dpaa2/dpmac.c:292:26: sparse: sparse: incorrect type in assignment (different base types) @@    expected unsigned int [usertype] mask @@    got restrunsigned int [usertype] mask @@
>> drivers/net/ethernet/freescale/dpaa2/dpmac.c:292:26: sparse:    expected unsigned int [usertype] mask
   drivers/net/ethernet/freescale/dpaa2/dpmac.c:292:26: sparse:    got restricted __le32 [usertype]
>> drivers/net/ethernet/freescale/dpaa2/dpmac.c:337:17: sparse: sparse: cast to restricted __le32
>> drivers/net/ethernet/freescale/dpaa2/dpmac.c:371:28: sparse: sparse: incorrect type in assignment (different base types) @@    expected unsigned int [usertype] status @@    got restrunsigned int [usertype] status @@
>> drivers/net/ethernet/freescale/dpaa2/dpmac.c:371:28: sparse:    expected unsigned int [usertype] status
   drivers/net/ethernet/freescale/dpaa2/dpmac.c:371:28: sparse:    got restricted __le32 [usertype]
   drivers/net/ethernet/freescale/dpaa2/dpmac.c:381:19: sparse: sparse: cast to restricted __le32
   drivers/net/ethernet/freescale/dpaa2/dpmac.c:413:28: sparse: sparse: incorrect type in assignment (different base types) @@    expected unsigned int [usertype] status @@    got restrunsigned int [usertype] status @@
   drivers/net/ethernet/freescale/dpaa2/dpmac.c:413:28: sparse:    expected unsigned int [usertype] status
   drivers/net/ethernet/freescale/dpaa2/dpmac.c:413:28: sparse:    got restricted __le32 [usertype]
>> drivers/net/ethernet/freescale/dpaa2/dpmac.c:453:20: sparse: sparse: cast to restricted __le16
   drivers/net/ethernet/freescale/dpaa2/dpmac.c:454:26: sparse: sparse: cast to restricted __le32
>> drivers/net/ethernet/freescale/dpaa2/dpmac.c:488:24: sparse: sparse: cast to restricted __le64
   drivers/net/ethernet/freescale/dpaa2/dpmac.c:489:21: sparse: sparse: cast to restricted __le32
>> drivers/net/ethernet/freescale/dpaa2/dpmac.c:516:29: sparse: sparse: incorrect type in assignment (different base types) @@    expected unsigned long long [usertype] options @@    got nsigned long long [usertype] options @@
>> drivers/net/ethernet/freescale/dpaa2/dpmac.c:516:29: sparse:    expected unsigned long long [usertype] options
>> drivers/net/ethernet/freescale/dpaa2/dpmac.c:516:29: sparse:    got restricted __le64 [usertype]
>> drivers/net/ethernet/freescale/dpaa2/dpmac.c:517:26: sparse: sparse: incorrect type in assignment (different base types) @@    expected unsigned int [usertype] rate @@    got restrunsigned int [usertype] rate @@
>> drivers/net/ethernet/freescale/dpaa2/dpmac.c:517:26: sparse:    expected unsigned int [usertype] rate
   drivers/net/ethernet/freescale/dpaa2/dpmac.c:517:26: sparse:    got restricted __le32 [usertype]
   drivers/net/ethernet/freescale/dpaa2/dpmac.c:558:20: sparse: sparse: cast to restricted __le64
   drivers/net/ethernet/freescale/dpaa2/dpmac.c:615:22: sparse: sparse: cast to restricted __le16
   drivers/net/ethernet/freescale/dpaa2/dpmac.c:616:22: sparse: sparse: cast to restricted __le16

vim +67 drivers/net/ethernet/freescale/dpaa2/dpmac.c

    35	
    36	/**
    37	 * dpmac_open() - Open a control session for the specified object.
    38	 * @mc_io:	Pointer to MC portal's I/O object
    39	 * @cmd_flags:	Command flags; one or more of 'MC_CMD_FLAG_'
    40	 * @dpmac_id:	DPMAC unique ID
    41	 * @token:	Returned token; use in subsequent API calls
    42	 *
    43	 * This function can be used to open a control session for an
    44	 * already created object; an object may have been declared in
    45	 * the DPL or by calling the dpmac_create function.
    46	 * This function returns a unique authentication token,
    47	 * associated with the specific object ID and the specific MC
    48	 * portal; this token must be used in all subsequent commands for
    49	 * this specific object
    50	 *
    51	 * Return:	'0' on Success; Error code otherwise.
    52	 */
    53	int dpmac_open(struct fsl_mc_io *mc_io,
    54		       u32 cmd_flags,
    55		       int dpmac_id,
    56		       u16 *token)
    57	{
    58		struct dpmac_cmd_open *cmd_params;
    59		struct fsl_mc_command cmd = { 0 };
    60		int err;
    61	
    62		/* prepare command */
    63		cmd.header = mc_encode_cmd_header(DPMAC_CMDID_OPEN,
    64						  cmd_flags,
    65						  0);
    66		cmd_params = (struct dpmac_cmd_open *)cmd.params;
  > 67		cmd_params->dpmac_id = cpu_to_le32(dpmac_id);
    68	
    69		/* send command to mc*/
    70		err = mc_send_command(mc_io, &cmd);
    71		if (err)
    72			return err;
    73	
    74		/* retrieve response parameters */
    75		*token = mc_cmd_hdr_read_token(&cmd);
    76	
    77		return err;
    78	}
    79	
    80	/**
    81	 * dpmac_close() - Close the control session of the object
    82	 * @mc_io:	Pointer to MC portal's I/O object
    83	 * @cmd_flags:	Command flags; one or more of 'MC_CMD_FLAG_'
    84	 * @token:	Token of DPMAC object
    85	 *
    86	 * After this function is called, no further operations are
    87	 * allowed on the object without opening a new control session.
    88	 *
    89	 * Return:	'0' on Success; Error code otherwise.
    90	 */
    91	int dpmac_close(struct fsl_mc_io *mc_io,
    92			u32 cmd_flags,
    93			u16 token)
    94	{
    95		struct fsl_mc_command cmd = { 0 };
    96	
    97		/* prepare command */
    98		cmd.header = mc_encode_cmd_header(DPMAC_CMDID_CLOSE, cmd_flags,
    99						  token);
   100	
   101		/* send command to mc*/
   102		return mc_send_command(mc_io, &cmd);
   103	}
   104	
   105	/**
   106	 * dpmac_create() - Create the DPMAC object.
   107	 * @mc_io:	Pointer to MC portal's I/O object
   108	 * @dprc_token: Parent container token; '0' for default container
   109	 * @cmd_flags:	Command flags; one or more of 'MC_CMD_FLAG_'
   110	 * @cfg:	Configuration structure
   111	 * @obj_id:	Returned object id
   112	 *
   113	 * Create the DPMAC object, allocate required resources and
   114	 * perform required initialization.
   115	 *
   116	 * The function accepts an authentication token of a parent
   117	 * container that this object should be assigned to. The token
   118	 * can be '0' so the object will be assigned to the default container.
   119	 * The newly created object can be opened with the returned
   120	 * object id and using the container's associated tokens and MC portals.
   121	 *
   122	 * Return:	'0' on Success; Error code otherwise.
   123	 */
   124	int dpmac_create(struct fsl_mc_io *mc_io,
   125			 u16 dprc_token,
   126			 u32 cmd_flags,
   127			 const struct dpmac_cfg *cfg,
   128			 u32 *obj_id)
   129	{
   130		struct dpmac_cmd_create *cmd_params;
   131		struct fsl_mc_command cmd = { 0 };
   132		int err;
   133	
   134		/* prepare command */
   135		cmd.header = mc_encode_cmd_header(DPMAC_CMDID_CREATE,
   136						  cmd_flags,
   137						  dprc_token);
   138		cmd_params = (struct dpmac_cmd_create *)cmd.params;
 > 139		cmd_params->mac_id = cpu_to_le32(cfg->mac_id);
   140	
   141		/* send command to mc*/
   142		err = mc_send_command(mc_io, &cmd);
   143		if (err)
   144			return err;
   145	
   146		/* retrieve response parameters */
   147		*obj_id = mc_cmd_read_object_id(&cmd);
   148	
   149		return 0;
   150	}
   151	

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation

_______________________________________________
linux-arm-kernel mailing list
[email-masked]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel