All of lore.kernel.org
 help / color / mirror / Atom feed
From: Kees Cook <keescook@google.com>
To: Rodrigo Vivi <rodrigo.vivi@intel.com>
Cc: Mika Kahola <mika.kahola@intel.com>,
	intel-gfx@lists.freedesktop.org,
	LKML <linux-kernel@vger.kernel.org>
Subject: i915: enum intel_dpll_id cast
Date: Wed, 22 Nov 2017 12:54:49 -0800	[thread overview]
Message-ID: <CAGXu5jJ3Sa8Kj7JSFBfKn=35FSyGnimKvq2ES6u84Axvbo_BQg@mail.gmail.com> (raw)

Hi,

While doing Clang test builds, this was reported:

drivers/gpu/drm/i915/intel_ddi.c:1481:30: warning: implicit conversion
from enumeration type 'enum port' to different enumeration type 'enum
intel_dpll_id' [-Wenum-conversion]
        enum intel_dpll_id pll_id = port;
                           ~~~~~~   ^~~~

Which is from:

static void bxt_ddi_clock_get(struct intel_encoder *encoder,
                                struct intel_crtc_state *pipe_config)
{
        struct drm_i915_private *dev_priv = to_i915(encoder->base.dev);
        enum port port = intel_ddi_get_encoder_port(encoder);
        enum intel_dpll_id pll_id = port;

        pipe_config->port_clock = bxt_calc_pll_link(dev_priv, pll_id);
...
}

In looking at it, it seems to be harmless if as enum port has a
smaller range than enum intel_dpll_id. I just wanted to check if maybe
something might go weird, since DPLL_ID_LCPLL_2700 maybe ends up
getting seen as I915_MAX_PORTS?

enum port {
        PORT_NONE = -1,
        PORT_A = 0,
        PORT_B,
        PORT_C,
        PORT_D,
        PORT_E,
        I915_MAX_PORTS
};

enum intel_dpll_id {
...
        DPLL_ID_LCPLL_2700 = 5,
...
};


Thanks!

-Kees

-- 
Kees Cook
Pixel Security

             reply	other threads:[~2017-11-22 20:54 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-11-22 20:54 Kees Cook [this message]
2017-11-23 14:24 ` [Intel-gfx] i915: enum intel_dpll_id cast Ville Syrjälä
2017-11-23 14:24   ` Ville Syrjälä

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='CAGXu5jJ3Sa8Kj7JSFBfKn=35FSyGnimKvq2ES6u84Axvbo_BQg@mail.gmail.com' \
    --to=keescook@google.com \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mika.kahola@intel.com \
    --cc=rodrigo.vivi@intel.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.