From patchwork Wed Oct 27 21:25:34 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Carpenter X-Patchwork-Id: 286692 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id o9RLPvse021382 for ; Wed, 27 Oct 2010 21:26:18 GMT Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 872329F4BE for ; Wed, 27 Oct 2010 14:25:56 -0700 (PDT) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-wy0-f177.google.com (mail-wy0-f177.google.com [74.125.82.177]) by gabe.freedesktop.org (Postfix) with ESMTP id A5DFD9E75F for ; Wed, 27 Oct 2010 14:25:46 -0700 (PDT) Received: by wyf22 with SMTP id 22so1155495wyf.36 for ; Wed, 27 Oct 2010 14:25:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:date:from:to:cc:subject :message-id:mime-version:content-type:content-disposition:user-agent; bh=tR8x/U1Ii7NAnPV1wgKYkY8eEBQ46UijrZeKk/aVEUg=; b=aN3QEXjjFzSwnoe37XsL1fia5zRXbV4EImvZolShkKDWG9OkzK6NRGy0m+E1i8rTRt H32H3kDy8uBmC0rXk4lqF00O6ZPVwNps+PeJc+hLDgFw+cqzT0gAmFav49DUviFLFXMZ JTBYie2FvjuC6Eba58PrwrrGq4EK3dxJD07ms= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=date:from:to:cc:subject:message-id:mime-version:content-type :content-disposition:user-agent; b=upTk0blUKcbISPch2yW7bFACoqOrMFGRjcElGHkghC/2xiZNBs1k1GCNbWWpOJRA49 f5t4PccE5v8pahlT1iSkp3L6+KLpJ/t+XhhOowY67czpeBrnWZ6rsiRtcDdQwVtdB8fN XOlAdaloZVes4gOuKyMQjnAguHGzHdEgXwNpo= Received: by 10.227.157.134 with SMTP id b6mr4332351wbx.115.1288214745733; Wed, 27 Oct 2010 14:25:45 -0700 (PDT) Received: from bicker (h2df2.n1.ips.mtn.co.ug [41.210.173.242]) by mx.google.com with ESMTPS id b30sm220222wbb.16.2010.10.27.14.25.42 (version=TLSv1/SSLv3 cipher=RC4-MD5); Wed, 27 Oct 2010 14:25:45 -0700 (PDT) Date: Wed, 27 Oct 2010 23:25:34 +0200 From: Dan Carpenter To: Chris Wilson Subject: [patch] i915: fix impossible BUG_ON() test Message-ID: <20101027212534.GM6062@bicker> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.18 (2008-05-17) Cc: kernel-janitors@vger.kernel.org, dri-devel@lists.freedesktop.org X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: dri-devel-bounces+patchwork-dri-devel=patchwork.kernel.org@lists.freedesktop.org Errors-To: dri-devel-bounces+patchwork-dri-devel=patchwork.kernel.org@lists.freedesktop.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter1.kernel.org [140.211.167.41]); Wed, 27 Oct 2010 21:26:18 +0000 (UTC) diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c index 8eb8453..151d9c8 100644 --- a/drivers/gpu/drm/i915/i915_gem.c +++ b/drivers/gpu/drm/i915/i915_gem.c @@ -4082,10 +4082,11 @@ i915_gem_object_unpin(struct drm_gem_object *obj) struct drm_i915_gem_object *obj_priv = to_intel_bo(obj); WARN_ON(i915_verify_lists(dev)); - obj_priv->pin_count--; - BUG_ON(obj_priv->pin_count < 0); + BUG_ON(obj_priv->pin_count == 0); BUG_ON(obj_priv->gtt_space == NULL); + obj_priv->pin_count--; + /* If the object is no longer pinned, and is * neither active nor being flushed, then stick it on * the inactive list