All of lore.kernel.org
 help / color / mirror / Atom feed
* i915: enum intel_dpll_id cast
@ 2017-11-22 20:54 Kees Cook
  2017-11-23 14:24   ` Ville Syrjälä
  0 siblings, 1 reply; 3+ messages in thread
From: Kees Cook @ 2017-11-22 20:54 UTC (permalink / raw)
  To: Rodrigo Vivi; +Cc: Mika Kahola, intel-gfx, LKML

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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Intel-gfx] i915: enum intel_dpll_id cast
  2017-11-22 20:54 i915: enum intel_dpll_id cast Kees Cook
@ 2017-11-23 14:24   ` Ville Syrjälä
  0 siblings, 0 replies; 3+ messages in thread
From: Ville Syrjälä @ 2017-11-23 14:24 UTC (permalink / raw)
  To: Kees Cook; +Cc: Rodrigo Vivi, intel-gfx, LKML

On Wed, Nov 22, 2017 at 12:54:49PM -0800, Kees Cook wrote:
> 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?

BXT can only ever have port values PORT_[A-C] and the matching
dpll_id values (DPLL_ID_SKL_DPLL[0-2]), so it's fine.

Also that implicit cast is actually gone from the latest code thanks
to commit bb911536f07e ("drm/i915: Eliminate pll->state usage from
bxt_calc_pll_link()").

> 
> 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
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/intel-gfx

-- 
Ville Syrjälä
Intel OTC

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: i915: enum intel_dpll_id cast
@ 2017-11-23 14:24   ` Ville Syrjälä
  0 siblings, 0 replies; 3+ messages in thread
From: Ville Syrjälä @ 2017-11-23 14:24 UTC (permalink / raw)
  To: Kees Cook; +Cc: intel-gfx, LKML, Rodrigo Vivi

On Wed, Nov 22, 2017 at 12:54:49PM -0800, Kees Cook wrote:
> 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?

BXT can only ever have port values PORT_[A-C] and the matching
dpll_id values (DPLL_ID_SKL_DPLL[0-2]), so it's fine.

Also that implicit cast is actually gone from the latest code thanks
to commit bb911536f07e ("drm/i915: Eliminate pll->state usage from
bxt_calc_pll_link()").

> 
> 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
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/intel-gfx

-- 
Ville Syrjälä
Intel OTC
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2017-11-23 14:24 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-11-22 20:54 i915: enum intel_dpll_id cast Kees Cook
2017-11-23 14:24 ` [Intel-gfx] " Ville Syrjälä
2017-11-23 14:24   ` Ville Syrjälä

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.