aboutsummaryrefslogtreecommitdiff
path: root/hw/block/pflash_cfi01.c
diff options
context:
space:
mode:
Diffstat (limited to 'hw/block/pflash_cfi01.c')
-rw-r--r--hw/block/pflash_cfi01.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/hw/block/pflash_cfi01.c b/hw/block/pflash_cfi01.c
index 62d7a5661d..5f0ee9db00 100644
--- a/hw/block/pflash_cfi01.c
+++ b/hw/block/pflash_cfi01.c
@@ -707,6 +707,19 @@ static void pflash_cfi01_realize(DeviceState *dev, Error **errp)
int num_devices;
Error *local_err = NULL;
+ if (pfl->sector_len == 0) {
+ error_setg(errp, "attribute \"sector-length\" not specified or zero.");
+ return;
+ }
+ if (pfl->nb_blocs == 0) {
+ error_setg(errp, "attribute \"num-blocks\" not specified or zero.");
+ return;
+ }
+ if (pfl->name == NULL) {
+ error_setg(errp, "attribute \"name\" not specified.");
+ return;
+ }
+
total_len = pfl->sector_len * pfl->nb_blocs;
/* These are only used to expose the parameters of each device