drivers/enc28j60/enc28j60.c: fix counter var length#7857
drivers/enc28j60/enc28j60.c: fix counter var length#7857kYc0o merged 1 commit intoRIOT-OS:masterfrom
Conversation
jnohlgard
left a comment
There was a problem hiding this comment.
Looks fine except for one comment.
drivers/enc28j60/enc28j60.c
Outdated
| { | ||
| enc28j60_t *dev = (enc28j60_t *)netdev; | ||
| int res; | ||
| unsigned res; |
There was a problem hiding this comment.
Res is used uninitialized on L326. I think it is missing a res = in front of the spi_init_cs function call
There was a problem hiding this comment.
Actually, spi_init_cs returns an int, and the printf on L324/L325 uses %i as well. Was the original error message about a signed vs unsigned comparison on L337?
Removing the U from the definition of STARTUP_TIMEOUT would probably fix the comparison.
Another alternative would be to introduce a new variable unsigned count = 0 on line L334 instead. The compiler will see that res is unused after L325 and release the register/memory used by it. Also, the declaration of res could move to L323.
There was a problem hiding this comment.
Yes I agree making STARTUP_TIMEOUT an int would be better than continuing to create more problems.
|
@gebart I have addressed your comment, is this ready? |
f3db9dd to
58e3fab
Compare
|
Squashed. |
While compiling tests/driver_enc28j60 with clang in OS X it discovers several minor issues.
This PR fixes them.