[RESEND,1/2] drm/i915: workaround sparse warning on variable length arrays

Submitted by Jani Nikula on Oct. 4, 2016, 9:54 a.m.

Details

Message ID 1475574853-4178-1-git-send-email-jani.nikula@intel.com
State New
Headers show
Series "Series without cover letter" ( rev: 1 ) in Intel GFX

Not browsing as part of any series.

Commit Message

Jani Nikula Oct. 4, 2016, 9:54 a.m.
Fix sparse warning:

drivers/gpu/drm/i915/intel_device_info.c:195:31: warning: Variable
length array is used.

In truth the array does have constant length, but sparse is too dumb to
realize. This is a bit ugly, but silence the warning no matter what.

Fixes: 91bedd34abf0 ("drm/i915/bdw: Check for slice, subslice and EU count for BDW")
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
---
 drivers/gpu/drm/i915/intel_device_info.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Patch hide | download patch | download mbox

diff --git a/drivers/gpu/drm/i915/intel_device_info.c b/drivers/gpu/drm/i915/intel_device_info.c
index 73b6858600ac..1b20e160bc1f 100644
--- a/drivers/gpu/drm/i915/intel_device_info.c
+++ b/drivers/gpu/drm/i915/intel_device_info.c
@@ -192,7 +192,7 @@  static void broadwell_sseu_info_init(struct drm_i915_private *dev_priv)
 	struct sseu_dev_info *sseu = &mkwrite_device_info(dev_priv)->sseu;
 	const int s_max = 3, ss_max = 3, eu_max = 8;
 	int s, ss;
-	u32 fuse2, eu_disable[s_max];
+	u32 fuse2, eu_disable[3]; /* s_max */
 
 	fuse2 = I915_READ(GEN8_FUSE2);
 	sseu->slice_mask = (fuse2 & GEN8_F2_S_ENA_MASK) >> GEN8_F2_S_ENA_SHIFT;

Comments

On ti, 2016-10-04 at 12:54 +0300, Jani Nikula wrote:
> @@ -192,7 +192,7 @@ static void broadwell_sseu_info_init(struct drm_i915_private *dev_priv)
>  	struct sseu_dev_info *sseu = &mkwrite_device_info(dev_priv)->sseu;
>  	const int s_max = 3, ss_max = 3, eu_max = 8;

Does sparse shut up if you split these into their own lines?

>  	int s, ss;
> -	u32 fuse2, eu_disable[s_max];
> +	u32 fuse2, eu_disable[3]; /* s_max */

If not;

Reviewed-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>

Regards, Joonas
On Tue, 04 Oct 2016, Joonas Lahtinen <joonas.lahtinen@linux.intel.com> wrote:
> On ti, 2016-10-04 at 12:54 +0300, Jani Nikula wrote:
>> @@ -192,7 +192,7 @@ static void broadwell_sseu_info_init(struct drm_i915_private *dev_priv)
>>  	struct sseu_dev_info *sseu = &mkwrite_device_info(dev_priv)->sseu;
>>  	const int s_max = 3, ss_max = 3, eu_max = 8;
>
> Does sparse shut up if you split these into their own lines?
>
>>  	int s, ss;
>> -	u32 fuse2, eu_disable[s_max];
>> +	u32 fuse2, eu_disable[3]; /* s_max */
>
> If not;
>
> Reviewed-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>

No go, pushed this one. Thanks for the review.

How about patch 2/2?

BR,
Jani.