summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZdenek Kabelac <zkabelac@redhat.com>2014-04-17 09:59:54 +0200
committerZdenek Kabelac <zkabelac@redhat.com>2014-04-18 16:38:51 +0200
commit91eb8927fd83a8ddff7c4007c2421386946437e0 (patch)
tree227eba97b48cc4ad955adc25195f98703f68bed8
parent20179523e2ab0d0dce757e1a689f30ad4add3f17 (diff)
downloadlvm2-91eb8927fd83a8ddff7c4007c2421386946437e0.tar.gz
cleanup: skip zeroing of cleared areas
Zalloc mem is already zeroed.
-rw-r--r--daemons/dmeventd/dmeventd.c17
1 files changed, 5 insertions, 12 deletions
diff --git a/daemons/dmeventd/dmeventd.c b/daemons/dmeventd/dmeventd.c
index 32610ec10..e1235dd3d 100644
--- a/daemons/dmeventd/dmeventd.c
+++ b/daemons/dmeventd/dmeventd.c
@@ -218,9 +218,9 @@ static pthread_cond_t _timeout_cond = PTHREAD_COND_INITIALIZER;
static struct thread_status *_alloc_thread_status(const struct message_data *data,
struct dso_data *dso_data)
{
- struct thread_status *ret = (typeof(ret)) dm_zalloc(sizeof(*ret));
+ struct thread_status *ret;
- if (!ret)
+ if (!(ret = dm_zalloc(sizeof(*ret))))
return NULL;
if (!(ret->device.uuid = dm_strdup(data->device_uuid))) {
@@ -228,9 +228,6 @@ static struct thread_status *_alloc_thread_status(const struct message_data *dat
return NULL;
}
- ret->current_task = NULL;
- ret->device.name = NULL;
- ret->device.major = ret->device.minor = 0;
ret->dso_data = dso_data;
ret->events = data->events_field;
ret->timeout = data->timeout_secs;
@@ -411,11 +408,7 @@ static int _fill_device_data(struct thread_status *ts)
if (!ts->device.uuid)
return 0;
- ts->device.name = NULL;
- ts->device.major = ts->device.minor = 0;
-
- dmt = dm_task_create(DM_DEVICE_INFO);
- if (!dmt)
+ if (!(dmt = dm_task_create(DM_DEVICE_INFO)))
return 0;
if (!dm_task_set_uuid(dmt, ts->device.uuid))
@@ -424,8 +417,8 @@ static int _fill_device_data(struct thread_status *ts)
if (!dm_task_run(dmt))
goto fail;
- ts->device.name = dm_strdup(dm_task_get_name(dmt));
- if (!ts->device.name)
+ dm_free(ts->device.name);
+ if (!(ts->device.name = dm_strdup(dm_task_get_name(dmt))))
goto fail;
if (!dm_task_get_info(dmt, &dmi))