[Intel-gfx] [PATCH i-g-t] tests/gem_concurrent_all: Please the compiler regarding fscanfs unused result.

Marius Vlad marius.c.vlad at intel.com
Tue Apr 5 17:34:02 UTC 2016


On Tue, Apr 05, 2016 at 06:23:21PM +0100, Chris Wilson wrote:
> On Tue, Apr 05, 2016 at 08:13:23PM +0300, Marius Vlad wrote:
> > Signed-off-by: Marius Vlad <marius.c.vlad at intel.com>
> > ---
> >  tests/gem_concurrent_all.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/tests/gem_concurrent_all.c b/tests/gem_concurrent_all.c
> > index 10e5357..e84ded3 100644
> > --- a/tests/gem_concurrent_all.c
> > +++ b/tests/gem_concurrent_all.c
> > @@ -650,7 +650,7 @@ static int read_sysctl(const char *path)
> >  	FILE *file = fopen(path, "r");
> >  	int max = 0;
> >  	if (file) {
> > -		fscanf(file, "%d", &max);
> > +		igt_assert(fscanf(file, "%d", &max) == 1);
> 
> But the code is written in case fscanf() actually fails...
It will never fail...

Would (void) fscanf() be better?

> -Chris
> 
> -- 
> Chris Wilson, Intel Open Source Technology Centre
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 473 bytes
Desc: Digital signature
URL: <https://lists.freedesktop.org/archives/intel-gfx/attachments/20160405/5fc3302b/attachment.sig>


More information about the Intel-gfx mailing list