Skip to content

Commit

Permalink
drivers/video/matrox/matroxfb_maven.c: fix unsigned return type
Browse files Browse the repository at this point in the history
The function has an unsigned return type, but returns a negative constant
to indicate an error condition.  The result of calling the function is
only tested by comparison to 0, and thus unsigned is not needed and can be
dropped from the return type.

A sematic match that finds this problem is as follows:
(http://coccinelle.lip6.fr/)

// <smpl>
@exists@
identifier f;
constant C;
@@

 unsigned f(...)
 { <+...
*  return -C;
 ...+> }
// </smpl>

Signed-off-by: Julia Lawall <julia@diku.dk>
Cc: Petr Vandrovec <vandrove@vc.cvut.cz>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
  • Loading branch information
Julia Lawall authored and Linus Torvalds committed Oct 28, 2010
1 parent f0a2f35 commit 847fb8a
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/video/matrox/matroxfb_maven.c
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,7 @@ static int matroxfb_PLL_mavenclock(const struct matrox_pll_features2* pll,
return fxtal * (*feed) / (*in) * ctl->den;
}

static unsigned int matroxfb_mavenclock(const struct matrox_pll_ctl* ctl,
static int matroxfb_mavenclock(const struct matrox_pll_ctl *ctl,
unsigned int htotal, unsigned int vtotal,
unsigned int* in, unsigned int* feed, unsigned int* post,
unsigned int* htotal2) {
Expand Down

0 comments on commit 847fb8a

Please sign in to comment.