pkarashchenko commented on code in PR #9309:
URL: https://github.com/apache/nuttx/pull/9309#discussion_r1199628100
##########
drivers/mtd/w25qxxxjv.c:
##########
@@ -628,14 +626,9 @@ static void w25qxxxjv_write_disable(FAR struct
w25qxxxjv_dev_s *priv)
static void w25qxxxjv_set_die(FAR struct w25qxxxjv_dev_s *priv, uint8_t die)
{
- char buff[1] =
- {
- die,
- };
-
w25qxxxjv_write_enable(priv);
w25qxxxjv_command_write(priv->qspi, W25QXXXJV_SW_DIE_SELECT,
- (FAR const void *)buff, 1);
+ (FAR const void *)&die, 1);
Review Comment:
Yes. That is true, but `buf[1]` on stack will (most probably) give you
proper alignment implicitly and that could give you an unexpected behavior in
future.
I will be able to take a look here on Monday and provide a proper fix (that
will be to use a union for `uint32_t` and 4 bytes `uint8_t` array, so it will
ensure that address will be properly aligned, or explicit usage of align_data
attribute).
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]