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-Url: https://git.stricted.de/?a=commitdiff_plain;h=a7f7c364e8db9510a41f4074035454779e159dd9;p=GitHub%2Fexynos8895%2Fandroid_kernel_samsung_universal8895.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 dbbad8a16382..986889b6a1f6 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)