From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:36720) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QTrMZ-0002Bi-UH for qemu-devel@nongnu.org; Tue, 07 Jun 2011 04:10:13 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QTrMY-00020M-I0 for qemu-devel@nongnu.org; Tue, 07 Jun 2011 04:10:11 -0400 Received: from mail-wy0-f173.google.com ([74.125.82.173]:42696) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QTrMY-00020B-2j for qemu-devel@nongnu.org; Tue, 07 Jun 2011 04:10:10 -0400 Received: by wyb42 with SMTP id 42so3886659wyb.4 for ; Tue, 07 Jun 2011 01:10:09 -0700 (PDT) Date: Tue, 7 Jun 2011 09:09:54 +0100 From: Stefan Hajnoczi Message-ID: <20110607080954.GA10063@stefanha-thinkpad.localdomain> References: <1307376262-1255-1-git-send-email-pbonzini@redhat.com> <1307376262-1255-10-git-send-email-pbonzini@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1307376262-1255-10-git-send-email-pbonzini@redhat.com> Subject: Re: [Qemu-devel] [RFC PATCH v2 09/13] scsi: introduce the scsi-target device List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Paolo Bonzini Cc: qemu-devel@nongnu.org On Mon, Jun 06, 2011 at 06:04:18PM +0200, Paolo Bonzini wrote: > +static SCSIRequest *scsi_new_request(SCSIDevice *d, DeviceState *initiator, > + uint32_t tag, uint32_t lun) > +{ > + SCSITargetState *s = DO_UPCAST(SCSITargetState, qdev, d); > + SCSIRequest *req; > + SCSITargetReq *r; > + > + req = scsi_req_alloc(sizeof(SCSITargetReq), &s->qdev, initiator, tag, lun); > + r = DO_UPCAST(SCSITargetReq, req, req); r not needed > + return req; > +} > + > +static void scsi_free_request(SCSIRequest *req) > +{ > + SCSITargetReq *r = DO_UPCAST(SCSITargetReq, req, req); > + > + if (r->p_buf) { > + qemu_free(r->p_buf); > + } qemu_free(NULL) is a nop, no need to check NULL Stefan