From patchwork Thu Sep 3 12:27:55 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 11753515 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 98906618 for ; Thu, 3 Sep 2020 12:39:59 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 653B6206EF for ; Thu, 3 Sep 2020 12:39:59 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="gdY6th4z" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 653B6206EF Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:32838 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kDoX0-0000ho-B7 for patchwork-qemu-devel@patchwork.kernel.org; Thu, 03 Sep 2020 08:39:58 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:53418) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kDoMA-00009Z-WA for qemu-devel@nongnu.org; Thu, 03 Sep 2020 08:28:47 -0400 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:57252) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1kDoM9-0007qK-Cq for qemu-devel@nongnu.org; Thu, 03 Sep 2020 08:28:46 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1599136124; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=exUO2EBEU4GpUyorzocM/dFFi//P9vU8D1aRpXB50hw=; b=gdY6th4z7YdMfitrlpssrh3vFRvmqlqZEa5cyWDcbLSQZBxnvFjYA+hQoXd28iNJcdIdfx iYqwOtSllDcnPK2ZUQottmPF+nVYuqAE3zASCdpKUpTbedqvD3hnl44KJ/Y/51oSnryhUu TRf0mq89BTF6tUIaU2ZLI/0zyn7MV8M= Received: from mail-wm1-f72.google.com (mail-wm1-f72.google.com [209.85.128.72]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-84-4aL5Vu6wNey90HAd5Dulcw-1; Thu, 03 Sep 2020 08:28:41 -0400 X-MC-Unique: 4aL5Vu6wNey90HAd5Dulcw-1 Received: by mail-wm1-f72.google.com with SMTP id c72so909741wme.4 for ; Thu, 03 Sep 2020 05:28:40 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=exUO2EBEU4GpUyorzocM/dFFi//P9vU8D1aRpXB50hw=; b=OwBo/GRaerfq8GO3NoFw1VrSiBS+zROoryx0S3SVmALygmoRYXoCseMamVzrYd+dUS VO7xzKH6j6bRe3Og0VZuvlTQ9UB2hJDUQlQ7bMo7EEMXXzt/dTSuHm1ziYkc+Ccq1ULA DheduXw3tEY4idS9+TZdXAqNMHtO+IgnTDaKyHN42vyAlTecWt9/atJQIB5teXDPu4Hy W8jKPnM4cW/r4C9rLBbulRzAhnZFsO7ZNkUFv8pFK2M0Nwom/xEdjsmiNzaio9Fnci1i sDUpcfwXPAY1GI0CRakr5JHsa9rtOiWaJtgDW7O6qomm9oVZJjf8N8NBWBl2puxMLQyN bj/Q== X-Gm-Message-State: AOAM532L9xBhCVPVVO6gitPCwzI75a4ajuIhv+hZtJLfuetBGtL5Ve+P WtOUyAe7goHkMlm/6tK3NqzRLXXnfzwEQeqazsKt1e3OO90poeXm9dphFpHJ+W10i+KqKjQtXlA 01kaOmdAJULdp64I= X-Received: by 2002:a5d:4151:: with SMTP id c17mr2372112wrq.302.1599136119611; Thu, 03 Sep 2020 05:28:39 -0700 (PDT) X-Google-Smtp-Source: ABdhPJweMps3wEorlmNZrDTFoX/ZU5uxPk2jPc2rbAcbuapIyQlYZm6CDSgFmO+ui6wF8NDqf/V1FQ== X-Received: by 2002:a5d:4151:: with SMTP id c17mr2372089wrq.302.1599136119386; Thu, 03 Sep 2020 05:28:39 -0700 (PDT) Received: from localhost.localdomain (50.red-83-52-54.dynamicip.rima-tde.net. [83.52.54.50]) by smtp.gmail.com with ESMTPSA id h185sm4345334wme.25.2020.09.03.05.28.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 03 Sep 2020 05:28:38 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [PATCH v7 07/15] block/nvme: Rename local variable Date: Thu, 3 Sep 2020 14:27:55 +0200 Message-Id: <20200903122803.405265-8-philmd@redhat.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200903122803.405265-1-philmd@redhat.com> References: <20200903122803.405265-1-philmd@redhat.com> MIME-Version: 1.0 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=philmd@redhat.com X-Mimecast-Spam-Score: 0.002 X-Mimecast-Originator: redhat.com Received-SPF: pass client-ip=63.128.21.124; envelope-from=philmd@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/09/03 04:23:54 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Fam Zheng , Kevin Wolf , qemu-block@nongnu.org, Klaus Jensen , Max Reitz , Stefan Hajnoczi , Keith Busch , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Stefano Garzarella Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" We are going to modify the code in the next commit. Renaming the 'resp' variable to 'id' first makes the next commit easier to review. No logical changes. Reviewed-by: Stefan Hajnoczi Reviewed-by: Stefano Garzarella Signed-off-by: Philippe Mathieu-Daudé --- block/nvme.c | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/block/nvme.c b/block/nvme.c index 909a565184d..0992f2fb579 100644 --- a/block/nvme.c +++ b/block/nvme.c @@ -510,8 +510,8 @@ static void nvme_identify(BlockDriverState *bs, int namespace, Error **errp) BDRVNVMeState *s = bs->opaque; NvmeIdCtrl *idctrl; NvmeIdNs *idns; + uint8_t *id; NvmeLBAF *lbaf; - uint8_t *resp; uint16_t oncs; int r; uint64_t iova; @@ -520,14 +520,14 @@ static void nvme_identify(BlockDriverState *bs, int namespace, Error **errp) .cdw10 = cpu_to_le32(0x1), }; - resp = qemu_try_blockalign0(bs, sizeof(NvmeIdCtrl)); - if (!resp) { + id = qemu_try_blockalign0(bs, sizeof(NvmeIdCtrl)); + if (!id) { error_setg(errp, "Cannot allocate buffer for identify response"); goto out; } - idctrl = (NvmeIdCtrl *)resp; - idns = (NvmeIdNs *)resp; - r = qemu_vfio_dma_map(s->vfio, resp, sizeof(NvmeIdCtrl), true, &iova); + idctrl = (NvmeIdCtrl *)id; + idns = (NvmeIdNs *)id; + r = qemu_vfio_dma_map(s->vfio, id, sizeof(NvmeIdCtrl), true, &iova); if (r) { error_setg(errp, "Cannot map buffer for DMA"); goto out; @@ -554,8 +554,7 @@ static void nvme_identify(BlockDriverState *bs, int namespace, Error **errp) s->supports_write_zeroes = !!(oncs & NVME_ONCS_WRITE_ZEROES); s->supports_discard = !!(oncs & NVME_ONCS_DSM); - memset(resp, 0, 4096); - + memset(id, 0, 4096); cmd.cdw10 = 0; cmd.nsid = cpu_to_le32(namespace); if (nvme_cmd_sync(bs, s->queues[INDEX_ADMIN], &cmd)) { @@ -587,8 +586,8 @@ static void nvme_identify(BlockDriverState *bs, int namespace, Error **errp) s->blkshift = lbaf->ds; out: - qemu_vfio_dma_unmap(s->vfio, resp); - qemu_vfree(resp); + qemu_vfio_dma_unmap(s->vfio, id); + qemu_vfree(id); } static bool nvme_poll_queues(BDRVNVMeState *s)