From: Wolfram Sang <wsa+renesas@sang-engineering.com>
To: qemu-devel@nongnu.org
Cc: linux-renesas-soc@vger.kernel.org,
"Wolfram Sang" <wsa+renesas@sang-engineering.com>,
"Philippe Mathieu-Daudé" <f4bug@amsat.org>
Subject: [Qemu-devel] [PATCH v3 RESEND 2/3] nvram: at24c: use a sane default for "rom-size"
Date: Sun, 20 May 2018 09:00:36 +0200 [thread overview]
Message-ID: <20180520070037.8593-3-wsa+renesas@sang-engineering.com> (raw)
In-Reply-To: <20180520070037.8593-1-wsa+renesas@sang-engineering.com>
0 as "rom-size" will lead to an error message. Let's use the size of a
small 24c01 which has 128 byte.
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
---
hw/nvram/eeprom_at24c.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/hw/nvram/eeprom_at24c.c b/hw/nvram/eeprom_at24c.c
index ccf78b25e4..ab1ef686e2 100644
--- a/hw/nvram/eeprom_at24c.c
+++ b/hw/nvram/eeprom_at24c.c
@@ -28,6 +28,9 @@
#define TYPE_AT24C_EE "at24c-eeprom"
#define AT24C_EE(obj) OBJECT_CHECK(EEPROMState, (obj), TYPE_AT24C_EE)
+/* default is the size of a 24c01 EEPROM */
+#define AT24C_ROMSIZE_DEFAULT 128
+
typedef struct EEPROMState {
I2CSlave parent_obj;
@@ -171,7 +174,7 @@ void at24c_eeprom_reset(DeviceState *state)
}
static Property at24c_eeprom_props[] = {
- DEFINE_PROP_UINT32("rom-size", EEPROMState, rsize, 0),
+ DEFINE_PROP_UINT32("rom-size", EEPROMState, rsize, AT24C_ROMSIZE_DEFAULT),
DEFINE_PROP_BOOL("writable", EEPROMState, writable, true),
DEFINE_PROP_DRIVE("drive", EEPROMState, blk),
DEFINE_PROP_END_OF_LIST()
--
2.11.0
next prev parent reply other threads:[~2018-05-20 7:00 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-05-20 7:00 [Qemu-devel] [PATCH v3 RESEND 0/3] nvram: at24c: fix problems related to "rom-size" Wolfram Sang
2018-05-20 7:00 ` [Qemu-devel] [PATCH v3 RESEND 1/3] nvram: at24c: prevent segfault by checking "rom-size" Wolfram Sang
2018-05-20 7:00 ` Wolfram Sang [this message]
2018-05-20 7:00 ` [Qemu-devel] [PATCH v3 RESEND 3/3] nvram: at24c: use standard error reporting Wolfram Sang
2018-05-20 13:27 ` Peter Maydell
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20180520070037.8593-3-wsa+renesas@sang-engineering.com \
--to=wsa+renesas@sang-engineering.com \
--cc=f4bug@amsat.org \
--cc=linux-renesas-soc@vger.kernel.org \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).