From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:46172) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZuS0C-0007lp-GR for qemu-devel@nongnu.org; Thu, 05 Nov 2015 16:23:25 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZuS07-0004iF-LQ for qemu-devel@nongnu.org; Thu, 05 Nov 2015 16:23:24 -0500 Received: from mx1.redhat.com ([209.132.183.28]:35997) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZuS07-0004hP-G1 for qemu-devel@nongnu.org; Thu, 05 Nov 2015 16:23:19 -0500 Received: from int-mx13.intmail.prod.int.phx2.redhat.com (int-mx13.intmail.prod.int.phx2.redhat.com [10.5.11.26]) by mx1.redhat.com (Postfix) with ESMTPS id D5DCDE706B for ; Thu, 5 Nov 2015 21:23:17 +0000 (UTC) From: Bandan Das References: <1446595225-23608-1-git-send-email-bsd@redhat.com> <1446595225-23608-2-git-send-email-bsd@redhat.com> <1446711857.30393.3.camel@redhat.com> Date: Thu, 05 Nov 2015 16:23:16 -0500 In-Reply-To: <1446711857.30393.3.camel@redhat.com> (Gerd Hoffmann's message of "Thu, 05 Nov 2015 09:24:17 +0100") Message-ID: MIME-Version: 1.0 Content-Type: text/plain Subject: Re: [Qemu-devel] [PATCH 1/3] usb-mtp: use a list for keeping track of children List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Gerd Hoffmann Cc: qemu-devel@nongnu.org Gerd Hoffmann writes: >> static void usb_mtp_object_free(MTPState *s, MTPObject *o) >> { >> - int i; >> + MTPObject *iter; >> + >> + if (o) { >> + trace_usb_mtp_object_free(s->dev.addr, o->handle, o->path); > > That also makes usb_mtp_object_free callable with o == NULL. Makes > sense, but also makes this patch hard to review. Please consider either > splitting this out into a separate patch or code this as "if (!o) > { return; }" so the intention of the remaining code doesn't change. Sure, I will split up the call to usb_mtp_object_free() during reset to a separate patch and change the check here to if (!o). Bandan >> +static MTPObject *usb_mtp_add_child(MTPState *s, MTPObject *o, >> + char *name) >> +{ >> + MTPObject *child = >> + usb_mtp_object_alloc(s, s->next_handle++, o, name); >> + >> + if (child) { >> + trace_usb_mtp_add_child(s->dev.addr, child->handle, child->path); >> + QLIST_INSERT_HEAD(&o->children, child, list); >> + o->nchildren++; >> + >> + if (child->format == FMT_ASSOCIATION) { >> + QLIST_INIT(&child->children); >> + } >> + >> + } >> + >> + return child; >> +} > > Separate patch please. > > cheers, > Gerd