From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Mm7Ex-00076o-VL for qemu-devel@nongnu.org; Fri, 11 Sep 2009 10:36:43 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1Mm7Es-00074i-N6 for qemu-devel@nongnu.org; Fri, 11 Sep 2009 10:36:42 -0400 Received: from [199.232.76.173] (port=48520 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Mm7Es-00074c-GW for qemu-devel@nongnu.org; Fri, 11 Sep 2009 10:36:38 -0400 Received: from mx1.redhat.com ([209.132.183.28]:46525) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1Mm7Es-00065H-0m for qemu-devel@nongnu.org; Fri, 11 Sep 2009 10:36:38 -0400 Received: from int-mx02.intmail.prod.int.phx2.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id n8BEabm4008666 for ; Fri, 11 Sep 2009 10:36:37 -0400 Message-ID: <4AAA6072.8080407@redhat.com> Date: Fri, 11 Sep 2009 16:36:34 +0200 From: Gerd Hoffmann MIME-Version: 1.0 Subject: Re: [Qemu-devel] [PATCH 3/8] split away drive init from ide_init2() References: <1252672351-12937-1-git-send-email-kraxel@redhat.com> <1252672351-12937-4-git-send-email-kraxel@redhat.com> <87r5udd09p.fsf@pike.pond.sub.org> In-Reply-To: <87r5udd09p.fsf@pike.pond.sub.org> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Markus Armbruster Cc: qemu-devel@nongnu.org >> +void ide_init_drive(IDEState *s, DriveInfo *dinfo) >> +{ >> + int cylinders, heads, secs; >> + uint64_t nb_sectors; >> + >> + if (dinfo&& dinfo->bdrv) { >> + s->bs = dinfo->bdrv; > > Before, this assignement was executed even when !dinfo->bdrv. Can this > happen? Running this once with dinfo->bdrv = something, then with dinfo->bdrv = NULL (which is the only case where this matters) can't happen. You can't hot-unplut ide drives ;) The code used to be called once for initialization. Now it might be called twice for ide busses converted to qdev: Once with dinfo = NULL (when setting up the bus) and once with dinfo != NULL (when attaching the drive). cheers, Gerd