From patchwork Thu Aug 26 19:50:07 2021 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: 12460643 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id B8E6CC432BE for ; Thu, 26 Aug 2021 19:59:40 +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 6AA2760F45 for ; Thu, 26 Aug 2021 19:59:40 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 6AA2760F45 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=nongnu.org Received: from localhost ([::1]:47472 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mJLXH-00068z-Jp for qemu-devel@archiver.kernel.org; Thu, 26 Aug 2021 15:59:39 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:49224) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mJLOb-0005K5-Uw for qemu-devel@nongnu.org; Thu, 26 Aug 2021 15:50:41 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:23297) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mJLOZ-00035H-KB for qemu-devel@nongnu.org; Thu, 26 Aug 2021 15:50:41 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1630007438; 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=CPZfczG2XQrRC55s69h86ljHzGci8wjhwO3c1XD3j8g=; b=GvK9hLvlvCwfFG+v5riWOLsSPLU048yducizMLYKbnDGu5CIherS9cvXRTqybQyOJLwtIz bbxNRwvENe91Pd3gHnhw/lIjrYQHLB/pZmri2Dy4nVRQRAGBg/QAextRa7XDarLw+1mbMm a0gftFCIUZaRwkl7D3mCATEm/C+E1Ko= Received: from mail-wr1-f70.google.com (mail-wr1-f70.google.com [209.85.221.70]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-31-7Lbqu5ZGOAyWhv2G0osWyQ-1; Thu, 26 Aug 2021 15:50:35 -0400 X-MC-Unique: 7Lbqu5ZGOAyWhv2G0osWyQ-1 Received: by mail-wr1-f70.google.com with SMTP id l1-20020adff481000000b00156e670a09dso1221058wro.1 for ; Thu, 26 Aug 2021 12:50:35 -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=CPZfczG2XQrRC55s69h86ljHzGci8wjhwO3c1XD3j8g=; b=SapqYbIlxMGrYAcpZ+WSPMgBjIwxcQPic+UN9nLImDQKfdxCnp/Sy+PjQs1lBm1qzz TFPiVkYvNJa7DXh+GvULv3odisrHSub9X5yJUJxbStmdFvWnr8jMV9HKuYlKsQmaIwkF UATiirBUHbEAS3+NG+6mlGE0gGgsLvgFmgXWi4DV6F5x77SqheY2TIu5rVB5UtSMbbFS aurRcot/xnyNJr4NWeSHVudu1bgot+If6FD8aO4WezheX0+c7ASbSDK4r4f40KlGQVnV gOMxeFeebppPJG+tl1J79//GCP6S0zENU0QDipLC1pMAJFfTaIRyCO3bRhJdoQNYJBf5 ZDUg== X-Gm-Message-State: AOAM531Oft2ZmKuSKPjUsrEYgSRvRUg0kaEXrT3X/mf/AkIPKIEtwQrR qogP7LAK63v731XWN405P3pFfuMNIORDOSWXIQSCyMN9/eF1YnOLbJDQHjCvEf8h46pUuyEjGgH qNKQB0l13HDT/CdQ9Ts9iK3BsKZIK0Y3thjsxgSrJIqaYGxdPY+vbx1BNjnWxbNKD X-Received: by 2002:adf:edcf:: with SMTP id v15mr6037122wro.61.1630007434120; Thu, 26 Aug 2021 12:50:34 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxpPp74nFUTEVaLdtiLUSM5iwa51BcR3IivZ17saErSXnDIEFKbQUjijSVSLzvrnHoZPy7trQ== X-Received: by 2002:adf:edcf:: with SMTP id v15mr6037090wro.61.1630007433858; Thu, 26 Aug 2021 12:50:33 -0700 (PDT) Received: from x1w.. (163.red-83-52-55.dynamicip.rima-tde.net. [83.52.55.163]) by smtp.gmail.com with ESMTPSA id o5sm4003844wrw.17.2021.08.26.12.50.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 26 Aug 2021 12:50:33 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [PATCH v2 04/11] util/vfio-helpers: Remove unreachable code in qemu_vfio_dma_map() Date: Thu, 26 Aug 2021 21:50:07 +0200 Message-Id: <20210826195014.2180369-5-philmd@redhat.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210826195014.2180369-1-philmd@redhat.com> References: <20210826195014.2180369-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 X-Mimecast-Originator: redhat.com Received-SPF: pass client-ip=216.205.24.124; envelope-from=philmd@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -15 X-Spam_score: -1.6 X-Spam_bar: - X-Spam_report: (-1.6 / 5.0 requ) DKIMWL_WL_HIGH=-0.742, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham 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: Kevin Wolf , Fam Zheng , qemu-block@nongnu.org, Klaus Jensen , Auger Eric , Hanna Reitz , Stefan Hajnoczi , =?utf-8?q?Philippe_Mathieu-Daud?= =?utf-8?q?=C3=A9?= Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" qemu_vfio_add_mapping() returns a pointer to an indexed entry in pre-allocated QEMUVFIOState::mappings[], thus can not be NULL. Remove the pointless check. Reviewed-by: Klaus Jensen Signed-off-by: Philippe Mathieu-Daudé --- util/vfio-helpers.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/util/vfio-helpers.c b/util/vfio-helpers.c index d956866b4e9..e7909222cfd 100644 --- a/util/vfio-helpers.c +++ b/util/vfio-helpers.c @@ -751,10 +751,6 @@ int qemu_vfio_dma_map(QEMUVFIOState *s, void *host, size_t size, } mapping = qemu_vfio_add_mapping(s, host, size, index + 1, iova0); - if (!mapping) { - ret = -ENOMEM; - goto out; - } assert(qemu_vfio_verify_mappings(s)); ret = qemu_vfio_do_mapping(s, host, size, iova0); if (ret) {