[Intel-gfx] [PATCH 41/58] drm/i915: convert pointless error checks in set_config to BUGs

Daniel Vetter daniel.vetter at ffwll.ch
Wed Sep 5 21:19:01 CEST 2012


On Wed, Sep 5, 2012 at 6:50 PM, Jesse Barnes <jbarnes at virtuousgeek.org> 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 at ffwll.ch - +41 (0) 79 365 57 48 - http://blog.ffwll.ch



More information about the Intel-gfx mailing list