From patchwork Mon Feb 15 18:41:47 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rasmus Villemoes X-Patchwork-Id: 8320061 Return-Path: X-Original-To: patchwork-dri-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id AEB519F2F0 for ; Tue, 16 Feb 2016 00:46:32 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id F3411203A5 for ; Tue, 16 Feb 2016 00:46:31 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id 1F2E42039C for ; Tue, 16 Feb 2016 00:46:31 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 88ACD6E725; Tue, 16 Feb 2016 00:46:30 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-wm0-f43.google.com (mail-wm0-f43.google.com [74.125.82.43]) by gabe.freedesktop.org (Postfix) with ESMTPS id 27CC46E6CA for ; Mon, 15 Feb 2016 18:42:18 +0000 (UTC) Received: by mail-wm0-f43.google.com with SMTP id g62so72241574wme.1 for ; Mon, 15 Feb 2016 10:42:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rasmusvillemoes.dk; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=yLgBc1eML5g2NnoonZTnQNW1Olrj34CrhxP6eZOZcZE=; b=cmKZsrbFqO14IsONQLe00idFy8HafD6AplFz0En+7HIFp7WAwoQESwqMll3iiji9e4 tPy1+UvtcRodoYU0Um2oK9pDOeYnO88sF90Fo77++RQHui7yq+SOvY0yzjz+fWlcjpJZ QyraA/L5rceEgwg4noMQfvdXHUul94/2a2ICI= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=yLgBc1eML5g2NnoonZTnQNW1Olrj34CrhxP6eZOZcZE=; b=gm8Lt2UX0yVPMSDiOlrVkA/tH4uTBhem49zTi97O2pAl0MsGaXtunVHsWj+uPb9AL+ rht+gMKUnod4NZQkQSEcTd/KC9DxHgvs0NRnG1Kvs9gn+mX0DtQyY+fsWCcHGzzJooBk qaMa2ZscEk4s+FLEcOrCxlnOs3g6S7VbqC8wGpxLd1ZaF1oWoUlY38AtIZl9vT8wI9JL oI6xaWNwIg0dlhAAHUmIWkIK7cNeDuhYioqypk2kI0nhhByxxYkVuy3LluoagUj3HRhl W2gys6vZ0sXIpPf8YAj41nhrNT3oHHWPvL+y+Q9fu/Gtp7HvEiNTYgqMtluOzXVXKSGu 28dg== X-Gm-Message-State: AG10YORG9ZNXdCbIw+Jtls1WqI0+Kh2IKpmYYybB7H/nLXTfftZ69jeQblYYetIfLOlvyg== X-Received: by 10.194.174.73 with SMTP id bq9mr17647279wjc.145.1455561736942; Mon, 15 Feb 2016 10:42:16 -0800 (PST) Received: from wildmoose.dk (lvps87-230-87-209.dedicated.hosteurope.de. [87.230.87.209]) by smtp.gmail.com with ESMTPSA id l7sm26624463wjx.14.2016.02.15.10.42.16 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 15 Feb 2016 10:42:16 -0800 (PST) From: Rasmus Villemoes To: Alex Deucher , =?UTF-8?q?Christian=20K=C3=B6nig?= , David Airlie Subject: [PATCH 3/3] drm/radeon: use post-decrement in error handling Date: Mon, 15 Feb 2016 19:41:47 +0100 Message-Id: <1455561708-32390-4-git-send-email-linux@rasmusvillemoes.dk> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1455561708-32390-1-git-send-email-linux@rasmusvillemoes.dk> References: <1455561708-32390-1-git-send-email-linux@rasmusvillemoes.dk> X-Mailman-Approved-At: Tue, 16 Feb 2016 00:46:21 +0000 Cc: Rasmus Villemoes , linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Spam-Status: No, score=-4.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED,RP_MATCHES_RCVD,T_DKIM_INVALID,UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP We need to use post-decrement to get the pci_map_page undone also for i==0, and to avoid some very unpleasant behaviour if pci_map_page failed already at i==0. Signed-off-by: Rasmus Villemoes --- drivers/gpu/drm/radeon/radeon_ttm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/drm/radeon/radeon_ttm.c b/drivers/gpu/drm/radeon/radeon_ttm.c index e34307459e50..e06ac546a90f 100644 --- a/drivers/gpu/drm/radeon/radeon_ttm.c +++ b/drivers/gpu/drm/radeon/radeon_ttm.c @@ -758,7 +758,7 @@ static int radeon_ttm_tt_populate(struct ttm_tt *ttm) 0, PAGE_SIZE, PCI_DMA_BIDIRECTIONAL); if (pci_dma_mapping_error(rdev->pdev, gtt->ttm.dma_address[i])) { - while (--i) { + while (i--) { pci_unmap_page(rdev->pdev, gtt->ttm.dma_address[i], PAGE_SIZE, PCI_DMA_BIDIRECTIONAL); gtt->ttm.dma_address[i] = 0;