All of lore.kernel.org
 help / color / mirror / Atom feed
From: Daniel Vetter <daniel@ffwll.ch>
To: Paulo Zanoni <przanoni@gmail.com>
Cc: dri-devel@lists.freedesktop.org
Subject: Re: [PATCH 2/3] drm: add CRTC properties
Date: Tue, 17 Jan 2012 11:27:23 +0100	[thread overview]
Message-ID: <20120117102723.GD4093@phenom.ffwll.local> (raw)
In-Reply-To: <CA+gsUGShCbtGg4-4ScPcRxP30XjpPie8PP0_yd31LHLmnD3ANw@mail.gmail.com>

On Mon, Jan 16, 2012 at 06:29:36PM -0200, Paulo Zanoni wrote:
> Three comments about the design are inline:
> 
> > +void drm_crtc_attach_property(struct drm_crtc *crtc,
> > +                             struct drm_property *property, uint64_t init_val)
> > +{
> > +       int i;
> > +
> > +       for (i = 0; i < DRM_CRTC_MAX_PROPERTY; i++) {
> > +               if (crtc->property_ids[i] == 0) {
> > +                       crtc->property_ids[i] = property->base.id;
> > +                       crtc->property_values[i] = init_val;
> > +                       return;
> > +               }
> > +       }
> > +       BUG_ON(1);
> 
> I looked at drm_connector_attach_property and saw that instead of
> BUG_ON(1), it tries to return -EINVAL. The problem is that only zero
> callers check for the return value of drm_connector_attach_property. I
> can provide a patch for drm_connector_attach_property changing the
> -EINVAL for BUG_ON(1) if no one objects. Or I can also add -EINVAL to
> drm_crtc_attach_property and, to be consistent, not check for it :)

Just a quick comment: WARN is generally highly preferred over BUG. Use the
latter only when you know that the kernel _will_ go down in a horribly way
and it's better to stop it doing so (e.g. for NULL pointer checks).
-Daniel
-- 
Daniel Vetter
Mail: daniel@ffwll.ch
Mobile: +41 (0)79 365 57 48

  reply	other threads:[~2012-01-17 10:27 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <A+gsUGSBzJtaBhnAxPfdV4uBSw01VvAeTYSeCOtgr+UVfy0GjQ@mail.gmail.com>
2012-01-16 20:02 ` [PATCH 1/3] drm: add drm_property_change_is_valid Paulo Zanoni
2012-01-16 20:02   ` [PATCH 2/3] drm: add CRTC properties Paulo Zanoni
2012-01-16 20:29     ` Paulo Zanoni
2012-01-17 10:27       ` Daniel Vetter [this message]
2012-01-16 20:02   ` [PATCH 3/3] drm/i915: add 'rotation' CRTC property Paulo Zanoni

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20120117102723.GD4093@phenom.ffwll.local \
    --to=daniel@ffwll.ch \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=przanoni@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.