From patchwork Sat May 8 03:55:54 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Leizhen \(ThunderTown\)" X-Patchwork-Id: 432595 Delivered-To: patch@linaro.org Received: by 2002:a02:c901:0:0:0:0:0 with SMTP id t1csp908710jao; Fri, 7 May 2021 20:56:24 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyWOAnm4Tm3TCxWrCTSDGaiDglR9kQ8GwHPPtCUx7ZqPU+StdC1AnQUBC6Rvsq+nH6WKC/E X-Received: by 2002:a05:6a00:1a54:b029:278:e0f7:919d with SMTP id h20-20020a056a001a54b0290278e0f7919dmr13853636pfv.52.1620446184703; Fri, 07 May 2021 20:56:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1620446184; cv=none; d=google.com; s=arc-20160816; b=TadS/eqBtv7DxTwWHfLRoboGmge2D9ctnmSEW8BITHN2eYcwsnC55gby2PkRDIeB2p zO/ZLuVBUldr2sHEOuOT/Gxz0R5+eZlVhja6RrjFdM2cF9xTvhL7mbEbHIXsRQUEHlzc +zXASGThNU8JGhG1p4hMrzB14p9quDNpxEpQ3op9kV2FmOdE2M11SacQFMjeAm2x2RHE G6PfcvZRs0mQwYJS3XN1nrKmjhbHcKXqoT7i5+zVZfkdrjLdqeTM5FzhPQtXlIBOtkbK 31l5TIlsiDNy0kbD6G+zF5joZzUoF2+TJI+CJjH9yhVO0R3Xi0Tj2uX96kJqvDY2rYuZ KLQw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:message-id:date:subject:to:from:delivered-to; bh=fTnyR5lY8QviVfkAlvEJuSyEWI1m6HcoPbx3cNJ5gRI=; b=u1ix416Eh6/n+FwtpR1UJXITPzgTl5cIA18GQ3D+BL2uvFmPYFQQZ87twyTD+ywpaN w/UXf7NX16/1+Zt1WIcTiVlx35fm/ilBzsxN3Io0u2Hd2pmwcqhMXEjHdeO0ddlUP0VX ZsnMM+OlXFR+Jr2OcaHkbhuopiNuxZ1SZEH0Xoqa5tsrx75aa8tN59C7haJQnkZlsf70 0yWUYc8T5PagtyJT2gqYbUGkcwBi6mJz4h5I2Obk2hpx270PlJjyiKCRnHCh9nX1eZvP UREq28cu7vSTFVsmHDhIkx/8jwap7vDgExdufLfzq1hOVwtTxCoCrqRSwMZW3U+gGAjT d91w== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=huawei.com Return-Path: Received: from gabe.freedesktop.org (gabe.freedesktop.org. [131.252.210.177]) by mx.google.com with ESMTPS id g9si8604685plt.108.2021.05.07.20.56.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 07 May 2021 20:56:24 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) client-ip=131.252.210.177; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=huawei.com Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id B5F466E850; Sat, 8 May 2021 03:56:21 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from szxga04-in.huawei.com (szxga04-in.huawei.com [45.249.212.190]) by gabe.freedesktop.org (Postfix) with ESMTPS id 246B06E852 for ; Sat, 8 May 2021 03:56:20 +0000 (UTC) Received: from DGGEMS411-HUB.china.huawei.com (unknown [172.30.72.60]) by szxga04-in.huawei.com (SkyGuard) with ESMTP id 4FcYMT1TF9z16Pc9; Sat, 8 May 2021 11:53:41 +0800 (CST) Received: from thunder-town.china.huawei.com (10.174.177.72) by DGGEMS411-HUB.china.huawei.com (10.3.19.211) with Microsoft SMTP Server id 14.3.498.0; Sat, 8 May 2021 11:56:10 +0800 From: Zhen Lei To: David Airlie , Daniel Vetter , dri-devel , linux-kernel Subject: [PATCH 1/1] drm/mga: Fix error return code in mga_do_pci_dma_bootstrap() Date: Sat, 8 May 2021 11:55:54 +0800 Message-ID: <20210508035554.2424-1-thunder.leizhen@huawei.com> X-Mailer: git-send-email 2.26.0.windows.1 MIME-Version: 1.0 X-Originating-IP: [10.174.177.72] X-CFilter-Loop: Reflected X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Zhen Lei Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" The user may incorrectly set the value of dma_bs->secondary_bin_count to 0. In this case, the for loop is not entered and the 'err' value remains 0. Fixes: 6795c985a648 ("Add support for PCI MGA cards to MGA DRM.") Reported-by: Hulk Robot Signed-off-by: Zhen Lei --- drivers/gpu/drm/mga/mga_dma.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- 2.25.1 diff --git a/drivers/gpu/drm/mga/mga_dma.c b/drivers/gpu/drm/mga/mga_dma.c index 1cb7d120d18f..e41d44ec26de 100644 --- a/drivers/gpu/drm/mga/mga_dma.c +++ b/drivers/gpu/drm/mga/mga_dma.c @@ -693,7 +693,7 @@ static int mga_do_pci_dma_bootstrap(struct drm_device *dev, } if (bin_count == 0) { - DRM_ERROR("Unable to add secondary DMA buffers: %d\n", err); + DRM_ERROR("Unable to add secondary DMA buffers: %d\n", err ? : -EINVAL); return err; }