qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [PATCH 11/17] scsi: Pass local error object pointer to erro


From: Greg Kurz
Subject: [Qemu-devel] [PATCH 11/17] scsi: Pass local error object pointer to error_append_hint()
Date: Tue, 17 Sep 2019 12:21:40 +0200
User-agent: StGit/unknown-version

Ensure that hints are added even if errp is &error_fatal or &error_abort.

Signed-off-by: Greg Kurz <address@hidden>
---
 hw/scsi/scsi-disk.c    |    7 +++++--
 hw/scsi/scsi-generic.c |    7 +++++--
 2 files changed, 10 insertions(+), 4 deletions(-)

diff --git a/hw/scsi/scsi-disk.c b/hw/scsi/scsi-disk.c
index 915641a0f1b4..3d5e257bb66b 100644
--- a/hw/scsi/scsi-disk.c
+++ b/hw/scsi/scsi-disk.c
@@ -2619,9 +2619,12 @@ static void scsi_block_realize(SCSIDevice *dev, Error 
**errp)
     /* check we are using a driver managing SG_IO (version 3 and after) */
     rc = blk_ioctl(s->qdev.conf.blk, SG_GET_VERSION_NUM, &sg_version);
     if (rc < 0) {
-        error_setg_errno(errp, -rc, "cannot get SG_IO version number");
+        Error *local_err = NULL;
+
+        error_setg_errno(&local_err, -rc, "cannot get SG_IO version number");
         if (rc != -EPERM) {
-            error_append_hint(errp, "Is this a SCSI device?\n");
+            error_append_hint(&local_err, "Is this a SCSI device?\n");
+            error_propagate(errp, local_err);
         }
         goto out;
     }
diff --git a/hw/scsi/scsi-generic.c b/hw/scsi/scsi-generic.c
index e7798ebcd0d4..f6a5b538cbcc 100644
--- a/hw/scsi/scsi-generic.c
+++ b/hw/scsi/scsi-generic.c
@@ -674,9 +674,12 @@ static void scsi_generic_realize(SCSIDevice *s, Error 
**errp)
     /* check we are using a driver managing SG_IO (version 3 and after */
     rc = blk_ioctl(s->conf.blk, SG_GET_VERSION_NUM, &sg_version);
     if (rc < 0) {
-        error_setg_errno(errp, -rc, "cannot get SG_IO version number");
+        Error *local_err = NULL;
+
+        error_setg_errno(&local_err, -rc, "cannot get SG_IO version number");
         if (rc != -EPERM) {
-            error_append_hint(errp, "Is this a SCSI device?\n");
+            error_append_hint(&local_err, "Is this a SCSI device?\n");
+            error_propagate(errp, local_err);
         }
         return;
     }




reply via email to

[Prev in Thread] Current Thread [Next in Thread]