You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by "michallenc (via GitHub)" <gi...@apache.org> on 2023/05/19 14:13:18 UTC
[GitHub] [nuttx] michallenc commented on a diff in pull request #9309: Fix misc issues in code
michallenc commented on code in PR #9309:
URL: https://github.com/apache/nuttx/pull/9309#discussion_r1199012309
##########
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:
Hi @pkarashchenko. This change causes segmentation fault. Guess it is by `uint8_t die` being stack variable as it is passed to function as a parameter. I think we could go with
```C
char buff[1];
buff[0] = die;
w25qxxxjv_write_enable(priv);
w25qxxxjv_command_write(priv->qspi, W25QXXXJV_SW_DIE_SELECT,
(FAR const void *)buff, 1);
```
and still keep C89 compatibility, right?
--
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: commits-unsubscribe@nuttx.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org