RTEMS | GRCANFD: Fix Coverity issues (!390)
Matteo Concas (@matteo.concas)
gitlab at rtems.org
Thu Feb 6 07:52:06 UTC 2025
Matteo Concas commented on a discussion on bsps/shared/grlib/can/grcanfd.c: https://gitlab.rtems.org/rtems/rtos/rtems/-/merge_requests/390#note_119207
> return GRCAN_RET_INVARG;
> break;
> }
> - dest->head[1] = (dlc << 28) |
> + dest->head[1] = ((dlc & 0xf) << 28) |
Doing so would result in an implicit conversion in the current driver state which I don't really like. It would also break with how things are done to check for errors (checking if it's smaller than 0) in the file.
The mask, I believe, is also good from a readability perspective. One can quickly see that only the first 4 bits are valid for this var by simply reading the source code.
--
View it on GitLab: https://gitlab.rtems.org/rtems/rtos/rtems/-/merge_requests/390#note_119207
You're receiving this email because of your account on gitlab.rtems.org.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rtems.org/pipermail/bugs/attachments/20250206/d597d9d4/attachment-0001.htm>
More information about the bugs
mailing list