From c8837a57134230c335a85da22322fd794b19ff44 Mon Sep 17 00:00:00 2001 From: Antonio Ospite Date: Wed, 14 Nov 2012 12:01:34 +0100 Subject: [PATCH] am7xxx: assign device_list next to its first use This makes the code a little more readable. --- src/am7xxx.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/am7xxx.c b/src/am7xxx.c index 08858cd..47e04bb 100644 --- a/src/am7xxx.c +++ b/src/am7xxx.c @@ -453,8 +453,6 @@ static am7xxx_device *add_new_device(am7xxx_context *ctx) return NULL; } - devices_list = &(ctx->devices_list); - new_device = malloc(sizeof(*new_device)); if (new_device == NULL) { fatal("cannot allocate a new device (%s)\n", strerror(errno)); @@ -464,6 +462,8 @@ static am7xxx_device *add_new_device(am7xxx_context *ctx) new_device->ctx = ctx; + devices_list = &(ctx->devices_list); + if (*devices_list == NULL) { *devices_list = new_device; } else { -- 2.1.4