diff mbox series

iio: imu: adis16400: fix compiler warnings

Message ID 20191008085156.6255-1-alexandru.ardelean@analog.com (mailing list archive)
State New, archived
Headers show
Series iio: imu: adis16400: fix compiler warnings | expand

Commit Message

Alexandru Ardelean Oct. 8, 2019, 8:51 a.m. UTC
GCC 8 complains about plenty of 'maybe-uninitialized' warnings.
This patch fixes all of them.

Signed-off-by: Alexandru Ardelean <alexandru.ardelean@analog.com>
---
 drivers/iio/imu/adis16400.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

Comments

Jonathan Cameron Oct. 12, 2019, 11:48 a.m. UTC | #1
On Tue, 8 Oct 2019 11:51:56 +0300
Alexandru Ardelean <alexandru.ardelean@analog.com> wrote:

> GCC 8 complains about plenty of 'maybe-uninitialized' warnings.
> This patch fixes all of them.
> 
> Signed-off-by: Alexandru Ardelean <alexandru.ardelean@analog.com>
Applied in a bit of a hurry as Greg ran into these as well.

Pull request already gone out.

Thanks,

Jonathan

> ---
>  drivers/iio/imu/adis16400.c | 10 +++++-----
>  1 file changed, 5 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/iio/imu/adis16400.c b/drivers/iio/imu/adis16400.c
> index e042a2aabf6b..d0b7dce798f4 100644
> --- a/drivers/iio/imu/adis16400.c
> +++ b/drivers/iio/imu/adis16400.c
> @@ -325,7 +325,7 @@ static struct adis_burst adis16400_burst = {
>  static int adis16334_get_freq(struct adis16400_state *st)
>  {
>  	int ret;
> -	uint16_t t;
> +	uint16_t t = 0;
>  
>  	ret = __adis_read_reg_16(&st->adis, ADIS16400_SMPL_PRD, &t);
>  	if (ret < 0)
> @@ -338,7 +338,7 @@ static int adis16334_get_freq(struct adis16400_state *st)
>  
>  static int adis16334_set_freq(struct adis16400_state *st, unsigned int freq)
>  {
> -	unsigned int t;
> +	unsigned int t = 0;
>  
>  	if (freq < 819200)
>  		t = ilog2(819200 / freq);
> @@ -357,7 +357,7 @@ static int adis16334_set_freq(struct adis16400_state *st, unsigned int freq)
>  static int adis16400_get_freq(struct adis16400_state *st)
>  {
>  	int sps, ret;
> -	uint16_t t;
> +	uint16_t t = 0;
>  
>  	ret = __adis_read_reg_16(&st->adis, ADIS16400_SMPL_PRD, &t);
>  	if (ret < 0)
> @@ -408,7 +408,7 @@ static const unsigned int adis16400_3db_divisors[] = {
>  static int __adis16400_set_filter(struct iio_dev *indio_dev, int sps, int val)
>  {
>  	struct adis16400_state *st = iio_priv(indio_dev);
> -	uint16_t val16;
> +	uint16_t val16 = 0;
>  	int i, ret;
>  
>  	for (i = ARRAY_SIZE(adis16400_3db_divisors) - 1; i >= 1; i--) {
> @@ -554,7 +554,7 @@ static int adis16400_read_raw(struct iio_dev *indio_dev,
>  {
>  	struct adis16400_state *st = iio_priv(indio_dev);
>  	struct mutex *slock = &st->adis.state_lock;
> -	int16_t val16;
> +	int16_t val16 = 0;
>  	int ret;
>  
>  	switch (info) {
Jonathan Cameron Oct. 12, 2019, 12:06 p.m. UTC | #2
On Sat, 12 Oct 2019 12:48:30 +0100
Jonathan Cameron <jic23@kernel.org> wrote:

> On Tue, 8 Oct 2019 11:51:56 +0300
> Alexandru Ardelean <alexandru.ardelean@analog.com> wrote:
> 
> > GCC 8 complains about plenty of 'maybe-uninitialized' warnings.
> > This patch fixes all of them.
> > 
> > Signed-off-by: Alexandru Ardelean <alexandru.ardelean@analog.com>  
> Applied in a bit of a hurry as Greg ran into these as well.
> 
> Pull request already gone out.
> 
Note there are similar issues in adis.c, adis16480 and adis16136 that
could do with similar patches!

Thanks,

Jonathan

> Thanks,
> 
> Jonathan
> 
> > ---
> >  drivers/iio/imu/adis16400.c | 10 +++++-----
> >  1 file changed, 5 insertions(+), 5 deletions(-)
> > 
> > diff --git a/drivers/iio/imu/adis16400.c b/drivers/iio/imu/adis16400.c
> > index e042a2aabf6b..d0b7dce798f4 100644
> > --- a/drivers/iio/imu/adis16400.c
> > +++ b/drivers/iio/imu/adis16400.c
> > @@ -325,7 +325,7 @@ static struct adis_burst adis16400_burst = {
> >  static int adis16334_get_freq(struct adis16400_state *st)
> >  {
> >  	int ret;
> > -	uint16_t t;
> > +	uint16_t t = 0;
> >  
> >  	ret = __adis_read_reg_16(&st->adis, ADIS16400_SMPL_PRD, &t);
> >  	if (ret < 0)
> > @@ -338,7 +338,7 @@ static int adis16334_get_freq(struct adis16400_state *st)
> >  
> >  static int adis16334_set_freq(struct adis16400_state *st, unsigned int freq)
> >  {
> > -	unsigned int t;
> > +	unsigned int t = 0;
> >  
> >  	if (freq < 819200)
> >  		t = ilog2(819200 / freq);
> > @@ -357,7 +357,7 @@ static int adis16334_set_freq(struct adis16400_state *st, unsigned int freq)
> >  static int adis16400_get_freq(struct adis16400_state *st)
> >  {
> >  	int sps, ret;
> > -	uint16_t t;
> > +	uint16_t t = 0;
> >  
> >  	ret = __adis_read_reg_16(&st->adis, ADIS16400_SMPL_PRD, &t);
> >  	if (ret < 0)
> > @@ -408,7 +408,7 @@ static const unsigned int adis16400_3db_divisors[] = {
> >  static int __adis16400_set_filter(struct iio_dev *indio_dev, int sps, int val)
> >  {
> >  	struct adis16400_state *st = iio_priv(indio_dev);
> > -	uint16_t val16;
> > +	uint16_t val16 = 0;
> >  	int i, ret;
> >  
> >  	for (i = ARRAY_SIZE(adis16400_3db_divisors) - 1; i >= 1; i--) {
> > @@ -554,7 +554,7 @@ static int adis16400_read_raw(struct iio_dev *indio_dev,
> >  {
> >  	struct adis16400_state *st = iio_priv(indio_dev);
> >  	struct mutex *slock = &st->adis.state_lock;
> > -	int16_t val16;
> > +	int16_t val16 = 0;
> >  	int ret;
> >  
> >  	switch (info) {  
>
diff mbox series

Patch

diff --git a/drivers/iio/imu/adis16400.c b/drivers/iio/imu/adis16400.c
index e042a2aabf6b..d0b7dce798f4 100644
--- a/drivers/iio/imu/adis16400.c
+++ b/drivers/iio/imu/adis16400.c
@@ -325,7 +325,7 @@  static struct adis_burst adis16400_burst = {
 static int adis16334_get_freq(struct adis16400_state *st)
 {
 	int ret;
-	uint16_t t;
+	uint16_t t = 0;
 
 	ret = __adis_read_reg_16(&st->adis, ADIS16400_SMPL_PRD, &t);
 	if (ret < 0)
@@ -338,7 +338,7 @@  static int adis16334_get_freq(struct adis16400_state *st)
 
 static int adis16334_set_freq(struct adis16400_state *st, unsigned int freq)
 {
-	unsigned int t;
+	unsigned int t = 0;
 
 	if (freq < 819200)
 		t = ilog2(819200 / freq);
@@ -357,7 +357,7 @@  static int adis16334_set_freq(struct adis16400_state *st, unsigned int freq)
 static int adis16400_get_freq(struct adis16400_state *st)
 {
 	int sps, ret;
-	uint16_t t;
+	uint16_t t = 0;
 
 	ret = __adis_read_reg_16(&st->adis, ADIS16400_SMPL_PRD, &t);
 	if (ret < 0)
@@ -408,7 +408,7 @@  static const unsigned int adis16400_3db_divisors[] = {
 static int __adis16400_set_filter(struct iio_dev *indio_dev, int sps, int val)
 {
 	struct adis16400_state *st = iio_priv(indio_dev);
-	uint16_t val16;
+	uint16_t val16 = 0;
 	int i, ret;
 
 	for (i = ARRAY_SIZE(adis16400_3db_divisors) - 1; i >= 1; i--) {
@@ -554,7 +554,7 @@  static int adis16400_read_raw(struct iio_dev *indio_dev,
 {
 	struct adis16400_state *st = iio_priv(indio_dev);
 	struct mutex *slock = &st->adis.state_lock;
-	int16_t val16;
+	int16_t val16 = 0;
 	int ret;
 
 	switch (info) {