On Monday, July 30, 2018, 6:07:13 PM CEST Pankaj Bansal wrote: > [...] > @@ -666,8 +670,13 @@ static unsigned int flexcan_mailbox_read(struct can_rx_offload *offload, > { > struct flexcan_priv *priv = rx_offload_to_priv(offload); > struct flexcan_regs __iomem *regs = priv->regs; > - struct flexcan_mb __iomem *mb = ®s->mb[n]; > - u32 reg_ctrl, reg_id, reg_iflag1; > + struct flexcan_mb __iomem *mb; > + u32 reg_ctrl, reg_id, reg_iflag1, i, data; Shouldn't data be __be32 instead? > + u8 mb_size, can_dlc_dword; > + > + mb_size = sizeof(struct flexcan_mb) + priv->devtype_data->payload_size; > + > + mb = (struct flexcan_mb __iomem *)((u8 *)®s->mb + (mb_size * n)); > > if (priv->devtype_data->quirks & FLEXCAN_QUIRK_USE_OFF_TIMESTAMP) { > u32 code; > @@ -708,8 +717,11 @@ static unsigned int flexcan_mailbox_read(struct can_rx_offload *offload, > cf->can_id |= CAN_RTR_FLAG; > cf->can_dlc = get_can_dlc((reg_ctrl >> 16) & 0xf); > > - *(__be32 *)(cf->data + 0) = cpu_to_be32(priv->read(&mb->data[0])); > - *(__be32 *)(cf->data + 4) = cpu_to_be32(priv->read(&mb->data[1])); > + can_dlc_dword = (cf->can_dlc + sizeof(u32) - 1) / sizeof(u32); > + for (i = 0; i < can_dlc_dword; i++) { > + data = cpu_to_be32(priv->read(&mb->data[i])); > + *(__be32 *)(cf->data + (i * sizeof(u32))) = data; So sparse can help here when dealing with little/big-endianess when compiling using C=2. Best regards, Alexander -- SYS TEC electronic GmbH Am Windrad 2 08468 Heinsdorfergrund Germany Telefon : +49 (0) 3765 38600-0 Fax : +49 (0) 3765 38600-4100 Email : alexander.stein@xxxxxxxxxxxxxxxxxxxxx Website : http://www.systec-electronic.com Managing Director : Dipl.-Phys. Siegmar Schmidt Commercial registry : Amtsgericht Chemnitz, HRB 28082 USt.-Id Nr. : DE150534010 Diese E-Mail enthält vertrauliche und/oder rechtlich geschützte Informationen. Wenn Sie nicht der richtige Adressat sind oder diese E-Mail irrtümlich erhalten haben, informieren Sie bitte sofort den Absender und vernichten Sie diese Mail. Das unerlaubte Kopieren sowie die unbefugte Weitergabe dieser Mail sind nicht gestattet. This e-mail may contain confidential and/or privileged information. If you are not the intended recipient (or have received this e-mail in error) please notify the sender immediately and destroy this e-mail. Any unauthorized copying, disclosure or distribution of the material in this e-mail is strictly forbidden. -- To unsubscribe from this list: send the line "unsubscribe linux-can" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html