Re: [mkl-can-next:testing 9/14] drivers/net/can/flexcan.c:1262 flexcan_open() warn: should '1 << (priv->tx_mb_idx)' be a 64 bit type?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 3/5/19 1:39 PM, Dan Carpenter wrote:
> tree:   https://git.kernel.org/pub/scm/linux/kernel/git/mkl/linux-can-next.git testing
> head:   3871ad024254a4ee2b330b52b15a5f3fb5ae077b
> commit: c0ba9ac65ff1850978b6181318366814bcc5f1c8 [9/14] can: flexcan: introduce struct flexcan_priv::tx_mask and make use of it
> 
> smatch warnings:
> drivers/net/can/flexcan.c:1262 flexcan_open() warn: should '1 << (priv->tx_mb_idx)' be a 64 bit type?

Yes. It must be BIT_ULL() instead of BIT() then.

> # https://git.kernel.org/pub/scm/linux/kernel/git/mkl/linux-can-next.git/commit/?id=c0ba9ac65ff1850978b6181318366814bcc5f1c8
> git remote add mkl-can-next https://git.kernel.org/pub/scm/linux/kernel/git/mkl/linux-can-next.git
> git remote update mkl-can-next
> git checkout c0ba9ac65ff1850978b6181318366814bcc5f1c8
> vim +1262 drivers/net/can/flexcan.c
> 
> 0517961cc Pankaj Bansal     2018-11-23  1250  	priv->mb_size = sizeof(struct flexcan_mb) + CAN_MAX_DLEN;
> 6cbf76028 Pankaj Bansal     2018-08-28  1251  	priv->mb_count = (sizeof(priv->regs->mb[0]) / priv->mb_size) +
> 6cbf76028 Pankaj Bansal     2018-08-28  1252  			 (sizeof(priv->regs->mb[1]) / priv->mb_size);
> 0517961cc Pankaj Bansal     2018-11-23  1253  
> 5156c7b11 Pankaj Bansal     2018-08-13  1254  	if (priv->devtype_data->quirks & FLEXCAN_QUIRK_USE_OFF_TIMESTAMP)
> 0517961cc Pankaj Bansal     2018-11-23  1255  		priv->tx_mb_reserved =
> 0517961cc Pankaj Bansal     2018-11-23  1256  			flexcan_get_mb(priv, FLEXCAN_TX_MB_RESERVED_OFF_TIMESTAMP);
> 5156c7b11 Pankaj Bansal     2018-08-13  1257  	else
> 0517961cc Pankaj Bansal     2018-11-23  1258  		priv->tx_mb_reserved =
> 0517961cc Pankaj Bansal     2018-11-23  1259  			flexcan_get_mb(priv, FLEXCAN_TX_MB_RESERVED_OFF_FIFO);
> 0517961cc Pankaj Bansal     2018-11-23  1260  	priv->tx_mb_idx = priv->mb_count - 1;
> 0517961cc Pankaj Bansal     2018-11-23  1261  	priv->tx_mb = flexcan_get_mb(priv, priv->tx_mb_idx);
> c0ba9ac65 Marc Kleine-Budde 2019-03-01 @1262  	priv->tx_mask = FLEXCAN_IFLAG_MB(priv->tx_mb_idx);
>                                                 ^^^^^^^^^^^^^
> Presumably ->tx_mask is a u64?  Could it be made an unsigned long
> instead?

No. It should be an u64 and I'll use BIT_ULL().

> 5156c7b11 Pankaj Bansal     2018-08-13  1263  
> 5156c7b11 Pankaj Bansal     2018-08-13  1264  	priv->offload.mailbox_read = flexcan_mailbox_read;
> 5156c7b11 Pankaj Bansal     2018-08-13  1265  

Thanks,
Marc

-- 
Pengutronix e.K.                  | Marc Kleine-Budde           |
Industrial Linux Solutions        | Phone: +49-231-2826-924     |
Vertretung West/Dortmund          | Fax:   +49-5121-206917-5555 |
Amtsgericht Hildesheim, HRA 2686  | http://www.pengutronix.de   |

Attachment: signature.asc
Description: OpenPGP digital signature


[Index of Archives]     [Automotive Discussions]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]     [CAN Bus]

  Powered by Linux