* [patch] drm/nouveau/disp: add a comment on confusing loop
@ 2013-11-13 7:45 ` Dan Carpenter
0 siblings, 0 replies; 4+ messages in thread
From: Dan Carpenter @ 2013-11-13 7:45 UTC (permalink / raw)
To: David Airlie, Ben Skeggs
Cc: David Herrmann, Dave Airlie, Andy Shevchenko, dri-devel,
kernel-janitors
The "ret = -EIO" is deliberate. It's a very uncommon thing to do and it
upsets static checkers because they normally would expect "ret = -EIO".
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
diff --git a/drivers/gpu/drm/nouveau/core/engine/disp/dport.c b/drivers/gpu/drm/nouveau/core/engine/disp/dport.c
index 1bd4c63..2bc45ae 100644
--- a/drivers/gpu/drm/nouveau/core/engine/disp/dport.c
+++ b/drivers/gpu/drm/nouveau/core/engine/disp/dport.c
@@ -322,6 +322,7 @@ nouveau_dp_train(struct nouveau_disp *disp, const struct nouveau_dp_func *func,
while (*link_bw > (dp->dpcd[1] * 27000))
link_bw++;
+ /* set ret to -EIO on the last loop iteration */
while ((ret = -EIO) && link_bw[0]) {
/* find minimum required lane count at this link rate */
dp->link_nr = dp->dpcd[2] & DPCD_RC02_MAX_LANE_COUNT;
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [patch] drm/nouveau/disp: add a comment on confusing loop
@ 2013-11-13 7:45 ` Dan Carpenter
0 siblings, 0 replies; 4+ messages in thread
From: Dan Carpenter @ 2013-11-13 7:45 UTC (permalink / raw)
To: David Airlie, Ben Skeggs
Cc: David Herrmann, Dave Airlie, Andy Shevchenko, dri-devel,
kernel-janitors
The "ret = -EIO" is deliberate. It's a very uncommon thing to do and it
upsets static checkers because they normally would expect "ret == -EIO".
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
diff --git a/drivers/gpu/drm/nouveau/core/engine/disp/dport.c b/drivers/gpu/drm/nouveau/core/engine/disp/dport.c
index 1bd4c63..2bc45ae 100644
--- a/drivers/gpu/drm/nouveau/core/engine/disp/dport.c
+++ b/drivers/gpu/drm/nouveau/core/engine/disp/dport.c
@@ -322,6 +322,7 @@ nouveau_dp_train(struct nouveau_disp *disp, const struct nouveau_dp_func *func,
while (*link_bw > (dp->dpcd[1] * 27000))
link_bw++;
+ /* set ret to -EIO on the last loop iteration */
while ((ret = -EIO) && link_bw[0]) {
/* find minimum required lane count at this link rate */
dp->link_nr = dp->dpcd[2] & DPCD_RC02_MAX_LANE_COUNT;
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [patch] drm/nouveau/disp: add a comment on confusing loop
2013-11-13 7:45 ` Dan Carpenter
@ 2013-11-20 11:54 ` walter harms
-1 siblings, 0 replies; 4+ messages in thread
From: walter harms @ 2013-11-20 11:54 UTC (permalink / raw)
To: Dan Carpenter
Cc: David Airlie, Ben Skeggs, David Herrmann, Dave Airlie,
Andy Shevchenko, dri-devel, kernel-janitors
Am 13.11.2013 08:45, schrieb Dan Carpenter:
> The "ret = -EIO" is deliberate. It's a very uncommon thing to do and it
> upsets static checkers because they normally would expect "ret = -EIO".
>
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
>
> diff --git a/drivers/gpu/drm/nouveau/core/engine/disp/dport.c b/drivers/gpu/drm/nouveau/core/engine/disp/dport.c
> index 1bd4c63..2bc45ae 100644
> --- a/drivers/gpu/drm/nouveau/core/engine/disp/dport.c
> +++ b/drivers/gpu/drm/nouveau/core/engine/disp/dport.c
> @@ -322,6 +322,7 @@ nouveau_dp_train(struct nouveau_disp *disp, const struct nouveau_dp_func *func,
> while (*link_bw > (dp->dpcd[1] * 27000))
> link_bw++;
>
> + /* set ret to -EIO on the last loop iteration */
> while ((ret = -EIO) && link_bw[0]) {
> /* find minimum required lane count at this link rate */
> dp->link_nr = dp->dpcd[2] & DPCD_RC02_MAX_LANE_COUNT;
It is sensible to do so now,
but in the long runs it pays to rewrite that as it confuses not only
static checkers but also the brains of people trying to understand
the code.
just my 2 cents,
re,
wh
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [patch] drm/nouveau/disp: add a comment on confusing loop
@ 2013-11-20 11:54 ` walter harms
0 siblings, 0 replies; 4+ messages in thread
From: walter harms @ 2013-11-20 11:54 UTC (permalink / raw)
To: Dan Carpenter
Cc: David Airlie, Ben Skeggs, David Herrmann, Dave Airlie,
Andy Shevchenko, dri-devel, kernel-janitors
Am 13.11.2013 08:45, schrieb Dan Carpenter:
> The "ret = -EIO" is deliberate. It's a very uncommon thing to do and it
> upsets static checkers because they normally would expect "ret == -EIO".
>
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
>
> diff --git a/drivers/gpu/drm/nouveau/core/engine/disp/dport.c b/drivers/gpu/drm/nouveau/core/engine/disp/dport.c
> index 1bd4c63..2bc45ae 100644
> --- a/drivers/gpu/drm/nouveau/core/engine/disp/dport.c
> +++ b/drivers/gpu/drm/nouveau/core/engine/disp/dport.c
> @@ -322,6 +322,7 @@ nouveau_dp_train(struct nouveau_disp *disp, const struct nouveau_dp_func *func,
> while (*link_bw > (dp->dpcd[1] * 27000))
> link_bw++;
>
> + /* set ret to -EIO on the last loop iteration */
> while ((ret = -EIO) && link_bw[0]) {
> /* find minimum required lane count at this link rate */
> dp->link_nr = dp->dpcd[2] & DPCD_RC02_MAX_LANE_COUNT;
It is sensible to do so now,
but in the long runs it pays to rewrite that as it confuses not only
static checkers but also the brains of people trying to understand
the code.
just my 2 cents,
re,
wh
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2013-11-20 11:54 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-11-13 7:45 [patch] drm/nouveau/disp: add a comment on confusing loop Dan Carpenter
2013-11-13 7:45 ` Dan Carpenter
2013-11-20 11:54 ` walter harms
2013-11-20 11:54 ` walter harms
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.