block: Pass errp in blkconf_geometry

This allows us to pass error information to caller.

Reviewed-by: Andreas Färber <afaerber@suse.de>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Fam Zheng <famz@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
This commit is contained in:
Fam Zheng 2014-08-12 10:12:54 +08:00 committed by Paolo Bonzini
parent 2656eb7c59
commit 5ff5efb46c
5 changed files with 32 additions and 21 deletions

View file

@ -2237,6 +2237,7 @@ static void scsi_disk_unit_attention_reported(SCSIDevice *dev)
static int scsi_initfn(SCSIDevice *dev)
{
SCSIDiskState *s = DO_UPCAST(SCSIDiskState, qdev, dev);
Error *err = NULL;
if (!s->qdev.conf.bs) {
error_report("drive property not set");
@ -2250,9 +2251,13 @@ static int scsi_initfn(SCSIDevice *dev)
}
blkconf_serial(&s->qdev.conf, &s->serial);
if (dev->type == TYPE_DISK
&& blkconf_geometry(&dev->conf, NULL, 65535, 255, 255) < 0) {
return -1;
if (dev->type == TYPE_DISK) {
blkconf_geometry(&dev->conf, NULL, 65535, 255, 255, &err);
if (err) {
error_report("%s", error_get_pretty(err));
error_free(err);
return -1;
}
}
if (s->qdev.conf.discard_granularity == -1) {