From mboxrd@z Thu Jan 1 00:00:00 1970 From: Daniel Vetter Subject: Re: [PATCH 41/58] drm/i915: convert pointless error checks in set_config to BUGs Date: Wed, 5 Sep 2012 21:19:01 +0200 Message-ID: References: <1345403595-9678-1-git-send-email-daniel.vetter@ffwll.ch> <1345403595-9678-42-git-send-email-daniel.vetter@ffwll.ch> <20120905095026.56599e47@jbarnes-desktop> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mail-ob0-f177.google.com (mail-ob0-f177.google.com [209.85.214.177]) by gabe.freedesktop.org (Postfix) with ESMTP id 5BAB6A0A15 for ; Wed, 5 Sep 2012 12:19:02 -0700 (PDT) Received: by obbta17 with SMTP id ta17so956841obb.36 for ; Wed, 05 Sep 2012 12:19:01 -0700 (PDT) In-Reply-To: <20120905095026.56599e47@jbarnes-desktop> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: intel-gfx-bounces+gcfxdi-intel-gfx=m.gmane.org@lists.freedesktop.org Errors-To: intel-gfx-bounces+gcfxdi-intel-gfx=m.gmane.org@lists.freedesktop.org To: Jesse Barnes Cc: Intel Graphics Development List-Id: intel-gfx@lists.freedesktop.org On Wed, Sep 5, 2012 at 6:50 PM, Jesse Barnes wrote: >> @@ -6919,16 +6917,9 @@ static int intel_crtc_set_config(struct drm_mode_set *set) >> int ret; >> int i; >> >> - DRM_DEBUG_KMS("\n"); >> - >> - if (!set) >> - return -EINVAL; >> - >> - if (!set->crtc) >> - return -EINVAL; >> - >> - if (!set->crtc->helper_private) >> - return -EINVAL; >> + BUG_ON(!set); >> + BUG_ON(!set->crtc); >> + BUG_ON(!set->crtc->helper_private); >> >> if (!set->mode) >> set->fb = NULL; > > The BUG_ONs are probably superfluous too, but this is an improvement. Actually I want to add even more ;-) One of the follow-up cleanups I'd like to do is fix all the crazy assumptions in the fb helper (I guess we'll keep on using that one). And to make sure that no-one violates these accidentally, I'd like to check them in our code with BUG_ONs (so that people don't accidentally break i915.ko when they frob the fb helper or other parts of shared code we still use). So the BUG_ONs are just interface documentation and enforcement. -Daniel -- Daniel Vetter daniel.vetter@ffwll.ch - +41 (0) 79 365 57 48 - http://blog.ffwll.ch