diff options
author | Francisco Jerez <currojerez@riseup.net> | 2010-07-13 10:16:26 -0400 |
---|---|---|
committer | Ben Skeggs <bskeggs@redhat.com> | 2010-07-25 21:42:00 -0400 |
commit | eae6192a9d0d31f657b50873789175794767bf38 (patch) | |
tree | c3eab106a6c07a1b9b9c9436aa22ccbe7f04b806 /drivers/gpu/drm/nouveau | |
parent | c58754703c7d448c94aebf5e500d4278f6fc0678 (diff) |
drm/nouveau: Fix a sparse warning.
It doesn't like variable length arrays.
Signed-off-by: Francisco Jerez <currojerez@riseup.net>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Diffstat (limited to 'drivers/gpu/drm/nouveau')
-rw-r--r-- | drivers/gpu/drm/nouveau/nouveau_bios.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/drivers/gpu/drm/nouveau/nouveau_bios.c b/drivers/gpu/drm/nouveau/nouveau_bios.c index 0eb1b5ad0db1..31183a41b8d6 100644 --- a/drivers/gpu/drm/nouveau/nouveau_bios.c +++ b/drivers/gpu/drm/nouveau/nouveau_bios.c | |||
@@ -209,20 +209,20 @@ static struct methods shadow_methods[] = { | |||
209 | { "PCIROM", load_vbios_pci, true }, | 209 | { "PCIROM", load_vbios_pci, true }, |
210 | { "ACPI", load_vbios_acpi, true }, | 210 | { "ACPI", load_vbios_acpi, true }, |
211 | }; | 211 | }; |
212 | #define NUM_SHADOW_METHODS ARRAY_SIZE(shadow_methods) | ||
212 | 213 | ||
213 | static bool NVShadowVBIOS(struct drm_device *dev, uint8_t *data) | 214 | static bool NVShadowVBIOS(struct drm_device *dev, uint8_t *data) |
214 | { | 215 | { |
215 | const int nr_methods = ARRAY_SIZE(shadow_methods); | ||
216 | struct methods *methods = shadow_methods; | 216 | struct methods *methods = shadow_methods; |
217 | int testscore = 3; | 217 | int testscore = 3; |
218 | int scores[nr_methods], i; | 218 | int scores[NUM_SHADOW_METHODS], i; |
219 | 219 | ||
220 | if (nouveau_vbios) { | 220 | if (nouveau_vbios) { |
221 | for (i = 0; i < nr_methods; i++) | 221 | for (i = 0; i < NUM_SHADOW_METHODS; i++) |
222 | if (!strcasecmp(nouveau_vbios, methods[i].desc)) | 222 | if (!strcasecmp(nouveau_vbios, methods[i].desc)) |
223 | break; | 223 | break; |
224 | 224 | ||
225 | if (i < nr_methods) { | 225 | if (i < NUM_SHADOW_METHODS) { |
226 | NV_INFO(dev, "Attempting to use BIOS image from %s\n", | 226 | NV_INFO(dev, "Attempting to use BIOS image from %s\n", |
227 | methods[i].desc); | 227 | methods[i].desc); |
228 | 228 | ||
@@ -234,7 +234,7 @@ static bool NVShadowVBIOS(struct drm_device *dev, uint8_t *data) | |||
234 | NV_ERROR(dev, "VBIOS source \'%s\' invalid\n", nouveau_vbios); | 234 | NV_ERROR(dev, "VBIOS source \'%s\' invalid\n", nouveau_vbios); |
235 | } | 235 | } |
236 | 236 | ||
237 | for (i = 0; i < nr_methods; i++) { | 237 | for (i = 0; i < NUM_SHADOW_METHODS; i++) { |
238 | NV_TRACE(dev, "Attempting to load BIOS image from %s\n", | 238 | NV_TRACE(dev, "Attempting to load BIOS image from %s\n", |
239 | methods[i].desc); | 239 | methods[i].desc); |
240 | data[0] = data[1] = 0; /* avoid reuse of previous image */ | 240 | data[0] = data[1] = 0; /* avoid reuse of previous image */ |
@@ -245,7 +245,7 @@ static bool NVShadowVBIOS(struct drm_device *dev, uint8_t *data) | |||
245 | } | 245 | } |
246 | 246 | ||
247 | while (--testscore > 0) { | 247 | while (--testscore > 0) { |
248 | for (i = 0; i < nr_methods; i++) { | 248 | for (i = 0; i < NUM_SHADOW_METHODS; i++) { |
249 | if (scores[i] == testscore) { | 249 | if (scores[i] == testscore) { |
250 | NV_TRACE(dev, "Using BIOS image from %s\n", | 250 | NV_TRACE(dev, "Using BIOS image from %s\n", |
251 | methods[i].desc); | 251 | methods[i].desc); |