On Wed, 03 Oct 2012 09:23:36 +0200, Paul Bolle said: > By the way, GCC doesn't warn if I add an early check whether 'val_count' > is non-zero: > > diff --git a/drivers/base/regmap/regmap.c b/drivers/base/regmap/regmap.c > index c241ae2..d41527b 100644 > --- a/drivers/base/regmap/regmap.c > +++ b/drivers/base/regmap/regmap.c > @@ -1171,6 +1171,8 @@ int regmap_raw_read(struct regmap *map, unsigned int > reg, void *val, > unsigned int v; > int ret, i; > > + if (!val_count) > + return -EINVAL;
> That is another way to silence GCC here. That's probably a preferable approach - that way, if a bogus val_count gets passed in, the caller will be informed of the fact. Which is a lot better than just papering over the warning.
pgpfYqH7jx650.pgp
Description: PGP signature