linux-iio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] iio: imu: adis16400: fix compiler warnings
@ 2019-10-08  8:51 Alexandru Ardelean
  2019-10-12 11:48 ` Jonathan Cameron
  0 siblings, 1 reply; 3+ messages in thread
From: Alexandru Ardelean @ 2019-10-08  8:51 UTC (permalink / raw)
  To: linux-iio; +Cc: jic23, Alexandru Ardelean

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(-)

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) {
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] iio: imu: adis16400: fix compiler warnings
  2019-10-08  8:51 [PATCH] iio: imu: adis16400: fix compiler warnings Alexandru Ardelean
@ 2019-10-12 11:48 ` Jonathan Cameron
  2019-10-12 12:06   ` Jonathan Cameron
  0 siblings, 1 reply; 3+ messages in thread
From: Jonathan Cameron @ 2019-10-12 11:48 UTC (permalink / raw)
  To: Alexandru Ardelean; +Cc: linux-iio

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) {


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] iio: imu: adis16400: fix compiler warnings
  2019-10-12 11:48 ` Jonathan Cameron
@ 2019-10-12 12:06   ` Jonathan Cameron
  0 siblings, 0 replies; 3+ messages in thread
From: Jonathan Cameron @ 2019-10-12 12:06 UTC (permalink / raw)
  To: Alexandru Ardelean; +Cc: linux-iio

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) {  
> 


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2019-10-12 12:06 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-10-08  8:51 [PATCH] iio: imu: adis16400: fix compiler warnings Alexandru Ardelean
2019-10-12 11:48 ` Jonathan Cameron
2019-10-12 12:06   ` Jonathan Cameron

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).