From: Jonathan Cameron Date: Sun, 4 Dec 2011 19:10:58 +0000 (+0000) Subject: staging:iio:Documentation: cleanup properly in buffer handling code X-Git-Tag: v3.3-rc1~152^2~101^2~94 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=a7f7c364e8db9510a41f4074035454779e159dd9;p=profile%2Fivi%2Fkernel-x86-ivi.git staging:iio:Documentation: cleanup properly in buffer handling code Eating the endian description for now. Signed-off-by: Jonathan Cameron Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/staging/iio/Documentation/iio_utils.h b/drivers/staging/iio/Documentation/iio_utils.h index dbbad8a..986889b 100644 --- a/drivers/staging/iio/Documentation/iio_utils.h +++ b/drivers/staging/iio/Documentation/iio_utils.h @@ -145,9 +145,17 @@ inline int iioutils_get_type(unsigned *is_signed, ret = -errno; goto error_free_filename; } - fscanf(sysfsfp, - "%c%u/%u>>%u", &signchar, bits_used, - &padint, shift); + + ret = fscanf(sysfsfp, + "%ce:%c%u/%u>>%u", + &endianchar, + &signchar, + bits_used, + &padint, shift); + if (ret < 0) { + printf("failed to pass scan type description\n"); + return ret; + } *bytes = padint / 8; if (*bits_used == 64) *mask = ~0; @@ -157,6 +165,10 @@ inline int iioutils_get_type(unsigned *is_signed, *is_signed = 1; else *is_signed = 0; + fclose(sysfsfp); + free(filename); + + filename = 0; } error_free_filename: if (filename)