iio: accel: fxls8962af: Initialize return value
PATCH 1/1 iio: accel: fxls8962af: Initialize return value
kernel test robot throws below warning ->
smatch warnings:drivers/iio/accel/fxls8962af-core.c:640 fxls8962af_i2c_raw_read_errata3() error: uninitialized symbol 'ret'.
Initialize it.
--- drivers/iio/accel/fxls8962af-core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/iio/accel/fxls8962af-core.c +1 -1
@@ -628,7 +628,7 @@ static int fxls8962af_i2c_raw_read_errata3(struct fxls8962af_data *data, u16 *buffer, int samples, int sample_length) { - int i, ret; + int i, ret = -EINVAL; for (i = 0; i < samples; i++) { ret = regmap_raw_read(data->regmap, FXLS8962AF_BUF_X_LSB,
Signature · 1 line
2.25.1
Hi Souptick,
Quoted 21 lines · Souptick Joarder
kernel test robot throws below warning ->
smatch warnings:
drivers/iio/accel/fxls8962af-core.c:640fxls8962af_i2c_raw_read_errata3()error: uninitialized symbol 'ret'.Initialize it.
Reported-by kernel test robot <[email protected]>Reported-by Dan Carpenter <[email protected]>Signed-off-by Souptick Joarder <[email protected]>--- drivers/iio/accel/fxls8962af-core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/iio/accel/fxls8962af-core.c +0
-0
drivers/iio/accel/fxls8962af-core.c static int fxls8962af_i2c_raw_read_errata3(struct fxls8962af_data *data, · line 634
Quoted 8 lines
drivers/iio/accel/fxls8962af-core.c +1
-1@@ -628,7 +628,7 @@ static int fxls8962af_i2c_raw_read_errata3(struct fxls8962af_data *data, u16 *buffer, int samples, int sample_length) { - int i, ret; + int i, ret = -EINVAL; for (i = 0; i < samples; i++) { ret = regmap_raw_read(data->regmap, FXLS8962AF_BUF_X_LSB,
Would the change below work?
drivers/iio/accel/fxls8962af-core.c +0 -0
@@ -637,7 +637,7 @@ static int fxls8962af_i2c_raw_read_errata3(struct
fxls8962af_data *data,
return ret;
}- return ret;
+ return 0;
}
Hi Souptick and Fabio.
Quoted 15 lines · Fabio Estevam
Hi Souptick,
Quoted 12 lines · Souptick Joarder
kernel test robot throws below warning ->
smatch warnings:
drivers/iio/accel/fxls8962af-core.c:640fxls8962af_i2c_raw_read_errata3()error: uninitialized symbol 'ret'.Initialize it.
Reported-by kernel test robot <[email protected]>Reported-by Dan Carpenter <[email protected]>Signed-off-by Souptick Joarder <[email protected]>
Missing fixes-tag ;)
[ ... ]
drivers/iio/accel/fxls8962af-core.c static int fxls8962af_i2c_raw_read_errata3(struct · line 642
Quoted 13 lines
Would the change below work?
drivers/iio/accel/fxls8962af-core.c +1
-1@@ -637,7 +637,7 @@ static int fxls8962af_i2c_raw_read_errata3(structfxls8962af_data *data, return ret; } -return ret; +return 0 ; }
I have already submitted a patch for this :)
https://patchwork.kernel.org/project/linux-iio/patch/[email protected]/
/Sean
Quoted 35 lines · Souptick Joarder
Quoted 33 lines · Fabio Estevam,
Hi Souptick,
Quoted 9 lines · Souptick Joarder
kernel test robot throws below warning ->
smatch warnings:
drivers/iio/accel/fxls8962af-core.c:640fxls8962af_i2c_raw_read_errata3()error: uninitialized symbol 'ret'.Initialize it.
Review
Quoted 8 lines
Reported-by kernel test robot <[email protected]>Reported-by Dan Carpenter <[email protected]>Signed-off-by Souptick Joarder <[email protected]>--- drivers/iio/accel/fxls8962af-core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)(quoted diff) +0
-0
b/drivers/iio/accel/fxls8962af-core.cdrivers/iio/accel/fxls8962af-core.c static int fxls8962af_i2c_raw_read_errata3(struct
Quoted 4 lines
index
078d87865fde..8af1c8f58e83100644drivers/iio/accel/fxls8962af-core.c +0
-0@@ -628,7 +628,7 @@ static int fxls8962af_i2c_raw_read_errata3(struct
fxls8962af_data*data,Quoted 6 lines
drivers/iio/accel/fxls8962af-core.c +1
-1u16 *buffer, int samples, int sample_length) { - int i, ret; + int i, ret = -EINVAL;
Quoted 8 lines
Quoted 5 lines
drivers/iio/accel/fxls8962af-core.c static int fxls8962af_i2c_raw_read_errata3(struct · line 634
Quoted 2 lines
drivers/iio/accel/fxls8962af-core.c +0
-0for (i =0 ; i < samples; i++) { ret = regmap_raw_read(data->regmap, FXLS8962AF_BUF_X_LSB,Would the change below work?
This function returns
-ERRNOwhen failed. If it is not entering loop, ideally it should return-ERRNO, not 0. No ?
samples can't be 0, as fxls8962af_fifo_transfer() is never called if samples are 0 :)
Quoted 13 lines
Quoted 13 lines
drivers/iio/accel/fxls8962af-core.c +1
-1@@ -637,7 +637,7 @@ static int fxls8962af_i2c_raw_read_errata3(structfxls8962af_data *data, return ret; } -return ret; +return 0 ; }
Quoted 39 lines · Sean Nyekjaer
Quoted 38 lines · Souptick Joarder
Quoted 36 lines · Fabio Estevam,
Hi Souptick,
Quoted 9 lines · Souptick Joarder
kernel test robot throws below warning ->
smatch warnings:
drivers/iio/accel/fxls8962af-core.c:640fxls8962af_i2c_raw_read_errata3()error: uninitialized symbol 'ret'.Initialize it.
Review
Quoted 8 lines
Reported-by kernel test robot <[email protected]>Reported-by Dan Carpenter <[email protected]>Signed-off-by Souptick Joarder <[email protected]>--- drivers/iio/accel/fxls8962af-core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)(quoted diff) +0
-0
b/drivers/iio/accel/fxls8962af-core.cdrivers/iio/accel/fxls8962af-core.c static int fxls8962af_i2c_raw_read_errata3(struct
Quoted 4 lines
index
078d87865fde..8af1c8f58e83100644drivers/iio/accel/fxls8962af-core.c +0
-0@@ -628,7 +628,7 @@ static int fxls8962af_i2c_raw_read_errata3(struct
fxls8962af_data*data,Quoted 8 lines
drivers/iio/accel/fxls8962af-core.c +1
-1u16 *buffer, int samples, int sample_length) { - int i, ret; + int i, ret = -EINVAL; for (i = 0; i < samples; i++) { ret = regmap_raw_read(data->regmap, FXLS8962AF_BUF_X_LSB,
Quoted 9 lines
Quoted 5 lines
Quoted 2 lines
Would the change below work?
This function returns
-ERRNOwhen failed. If it is not entering loop, ideally it should return-ERRNO, not 0. No ?samples can't be 0, as
fxls8962af_fifo_transfer()is never called if samples are 0 :)
Yeah, you're right. Smatch can figure that out if you build the cross function DB, but it's a little bit trick for kbuild to use the DB when it runs on so many git trees. The DB takes hours to build so kbuild doesn't use it.
regards,
dan carpenter
Hi Sean,
Quoted 2 lines · Sean Nyekjaer
I have already submitted a patch for this :)
https://patchwork.kernel.org/project/linux-iio/patch/[email protected]/
Please resubmit your patch with a commit log.
Thanks