Perf tables v 1.2 and 1.3 (seen on Geforce FX / 5) are not long enough to store the voltage label/id Signed-off-by: Emil Velikov <emil.l.velikov at gmail.com> --- drivers/gpu/drm/nouveau/nouveau_perf.c | 6 +++++- 1 files changed, 5 insertions(+), 1 deletions(-) diff --git a/drivers/gpu/drm/nouveau/nouveau_perf.c b/drivers/gpu/drm/nouveau/nouveau_perf.c index ac62a1b..b09780b 100644 --- a/drivers/gpu/drm/nouveau/nouveau_perf.c +++ b/drivers/gpu/drm/nouveau/nouveau_perf.c @@ -134,7 +134,11 @@ nouveau_perf_init(struct drm_device *dev) case 0x13: case 0x15: perflvl->fanspeed = entry[55]; - perflvl->voltage = entry[56]; +/* + * Table v 1.2 and 1.3 does not have big enough recordlen to store the + * voltage + */ + perflvl->voltage = (recordlen > 56) ? entry[56] : 0; perflvl->core = ROM32(entry[1]) * 10; perflvl->memory = ROM32(entry[5]) * 20; break; -- 1.7.1
On Fri, 2011-03-18 at 00:46 +0000, Emil Velikov wrote:> Perf tables v 1.2 and 1.3 (seen on Geforce FX / 5) are not long enough to store > the voltage label/id > > Signed-off-by: Emil Velikov <emil.l.velikov at gmail.com> > --- > drivers/gpu/drm/nouveau/nouveau_perf.c | 6 +++++- > 1 files changed, 5 insertions(+), 1 deletions(-) > > diff --git a/drivers/gpu/drm/nouveau/nouveau_perf.c b/drivers/gpu/drm/nouveau/nouveau_perf.c > index ac62a1b..b09780b 100644 > --- a/drivers/gpu/drm/nouveau/nouveau_perf.c > +++ b/drivers/gpu/drm/nouveau/nouveau_perf.c > @@ -134,7 +134,11 @@ nouveau_perf_init(struct drm_device *dev) > case 0x13: > case 0x15: > perflvl->fanspeed = entry[55]; > - perflvl->voltage = entry[56]; > +/* > + * Table v 1.2 and 1.3 does not have big enough recordlen to store the > + * voltage > + */I'm not sure the comment is 100% necessary, but, it should be indented to the same level as the perflvl->* member settings.> + perflvl->voltage = (recordlen > 56) ? entry[56] : 0; > perflvl->core = ROM32(entry[1]) * 10; > perflvl->memory = ROM32(entry[5]) * 20; > break;
Perf tables v 1.2 and 1.3 (seen on Geforce FX/ 5) are not long enough to store the voltage label/id v2 - Remove comment from the code Signed-off-by: Emil Velikov <emil.l.velikov at gmail.com> --- drivers/gpu/drm/nouveau/nouveau_perf.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/drivers/gpu/drm/nouveau/nouveau_perf.c b/drivers/gpu/drm/nouveau/nouveau_perf.c index ac62a1b..670e3cb 100644 --- a/drivers/gpu/drm/nouveau/nouveau_perf.c +++ b/drivers/gpu/drm/nouveau/nouveau_perf.c @@ -134,7 +134,7 @@ nouveau_perf_init(struct drm_device *dev) case 0x13: case 0x15: perflvl->fanspeed = entry[55]; - perflvl->voltage = entry[56]; + perflvl->voltage = (recordlen > 56) ? entry[56] : 0; perflvl->core = ROM32(entry[1]) * 10; perflvl->memory = ROM32(entry[5]) * 20; break; -- 1.7.1
On Fri, 2011-03-18 at 20:19 +0000, Emil Velikov wrote:> Perf tables v 1.2 and 1.3 (seen on Geforce FX/ 5) are not long enough to store the voltage label/id > > v2 - Remove comment from the codeThank you :) Pushed, with the log message line split to fit into 80 chars. Ben.> > Signed-off-by: Emil Velikov <emil.l.velikov at gmail.com> > --- > drivers/gpu/drm/nouveau/nouveau_perf.c | 2 +- > 1 files changed, 1 insertions(+), 1 deletions(-) > > diff --git a/drivers/gpu/drm/nouveau/nouveau_perf.c b/drivers/gpu/drm/nouveau/nouveau_perf.c > index ac62a1b..670e3cb 100644 > --- a/drivers/gpu/drm/nouveau/nouveau_perf.c > +++ b/drivers/gpu/drm/nouveau/nouveau_perf.c > @@ -134,7 +134,7 @@ nouveau_perf_init(struct drm_device *dev) > case 0x13: > case 0x15: > perflvl->fanspeed = entry[55]; > - perflvl->voltage = entry[56]; > + perflvl->voltage = (recordlen > 56) ? entry[56] : 0; > perflvl->core = ROM32(entry[1]) * 10; > perflvl->memory = ROM32(entry[5]) * 20; > break;