error: Use error_report_err() where appropriate
Coccinelle semantic patch:
@@
expression E;
@@
- error_report("%s", error_get_pretty(E));
- error_free(E);
+ error_report_err(E);
@@
expression E, S;
@@
- error_report("%s", error_get_pretty(E));
+ error_report_err(E);
(
exit(S);
|
abort();
)
Trivial manual touch-ups in block/sheepdog.c.
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
diff --git a/block/sheepdog.c b/block/sheepdog.c
index be3176f..6a4a3bd 100644
--- a/block/sheepdog.c
+++ b/block/sheepdog.c
@@ -726,8 +726,7 @@
s->fd = get_sheep_fd(s, &local_err);
if (s->fd < 0) {
DPRINTF("Wait for connection to be established\n");
- error_report("%s", error_get_pretty(local_err));
- error_free(local_err);
+ error_report_err(local_err);
co_aio_sleep_ns(bdrv_get_aio_context(s->bs), QEMU_CLOCK_REALTIME,
1000000000ULL);
}
@@ -1283,8 +1282,7 @@
fd = connect_to_sdog(s, &local_err);
if (fd < 0) {
- error_report("%s", error_get_pretty(local_err));;
- error_free(local_err);
+ error_report_err(local_err);
return -EIO;
}
@@ -1292,8 +1290,7 @@
ret = find_vdi_name(s, s->name, snapid, tag, &vid, false, &local_err);
if (ret) {
- error_report("%s", error_get_pretty(local_err));;
- error_free(local_err);
+ error_report_err(local_err);
goto out;
}
@@ -1785,8 +1782,7 @@
fd = connect_to_sdog(s, &local_err);
if (fd < 0) {
- error_report("%s", error_get_pretty(local_err));;
- error_free(local_err);
+ error_report_err(local_err);
return;
}
@@ -1838,8 +1834,7 @@
fd = connect_to_sdog(s, &local_err);
if (fd < 0) {
- error_report("%s", error_get_pretty(local_err));;
- error_free(local_err);
+ error_report_err(local_err);
return fd;
}
@@ -1912,8 +1907,7 @@
fd = connect_to_sdog(s, &local_err);
if (fd < 0) {
- error_report("%s", error_get_pretty(local_err));;
- error_free(local_err);
+ error_report_err(local_err);
return false;
}
@@ -1960,8 +1954,7 @@
deleted = sd_delete(s);
ret = do_sd_create(s, &vid, !deleted, &local_err);
if (ret) {
- error_report("%s", error_get_pretty(local_err));;
- error_free(local_err);
+ error_report_err(local_err);
goto out;
}
@@ -1969,8 +1962,7 @@
fd = connect_to_sdog(s, &local_err);
if (fd < 0) {
- error_report("%s", error_get_pretty(local_err));;
- error_free(local_err);
+ error_report_err(local_err);
ret = fd;
goto out;
}
@@ -2218,8 +2210,7 @@
/* refresh inode. */
fd = connect_to_sdog(s, &local_err);
if (fd < 0) {
- error_report("%s", error_get_pretty(local_err));;
- error_free(local_err);
+ error_report_err(local_err);
ret = fd;
goto cleanup;
}
@@ -2234,8 +2225,7 @@
ret = do_sd_create(s, &new_vid, 1, &local_err);
if (ret < 0) {
- error_report("%s", error_get_pretty(local_err));;
- error_free(local_err);
+ error_report_err(local_err);
error_report("failed to create inode for snapshot. %s",
strerror(errno));
goto cleanup;
@@ -2336,8 +2326,7 @@
fd = connect_to_sdog(s, &local_err);
if (fd < 0) {
- error_report("%s", error_get_pretty(local_err));;
- error_free(local_err);
+ error_report_err(local_err);
ret = fd;
goto out;
}
@@ -2366,8 +2355,7 @@
fd = connect_to_sdog(s, &local_err);
if (fd < 0) {
- error_report("%s", error_get_pretty(local_err));;
- error_free(local_err);
+ error_report_err(local_err);
ret = fd;
goto out;
}
@@ -2429,8 +2417,7 @@
fd = connect_to_sdog(s, &local_err);
if (fd < 0) {
- error_report("%s", error_get_pretty(local_err));;
- error_free(local_err);
+ error_report_err(local_err);
return fd;
}