Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion drivers/iio/adc/ad_adc.c
Original file line number Diff line number Diff line change
Expand Up @@ -362,7 +362,7 @@
struct axiadc_state *st = iio_priv(indio_dev);
unsigned int i, ctrl;

for (i = 0; i < indio_dev->masklength; i++) {
for (i = 0; i < iio_get_masklength(indio_dev); i++) {
ctrl = axiadc_read(st, ADI_REG_CHAN_CNTRL(i));

if (test_bit(i, scan_mask))
Expand Down Expand Up @@ -409,7 +409,7 @@
}

val64 = (unsigned long long)val2 * 0x4000UL + (1000000UL / 2);
do_div(val64, 1000000UL);

Check warning on line 412 in drivers/iio/adc/ad_adc.c

View workflow job for this annotation

GitHub Actions / build_gcc_arm / build

kernel_smatch: inconsistent indenting

if (i & 0x4000 && val64 == 0x4000)
val64 = 0x3fff;
Expand Down
9 changes: 4 additions & 5 deletions drivers/iio/adc/ad_pulsar.c
Original file line number Diff line number Diff line change
Expand Up @@ -622,20 +622,19 @@
adc->info->num_channels);

last = find_last_bit(indio_dev->active_scan_mask,
indio_dev->masklength);
iio_get_masklength(indio_dev));

first = find_first_bit(indio_dev->active_scan_mask,
indio_dev->masklength);
iio_get_masklength(indio_dev));
if (num_en_ch > 1) {
second = find_next_bit(indio_dev->active_scan_mask,
indio_dev->masklength,
iio_get_masklength(indio_dev),
first + 1);
}

spi_message_init(msg);

for_each_set_bit(ch, indio_dev->active_scan_mask,
indio_dev->masklength) {
iio_for_each_active_channel(indio_dev, ch) {
active_ch[i] = ch;
i++;
}
Expand All @@ -645,14 +644,14 @@
* Datasheet page 31)
*/
for (i = 0; i < num_en_ch; i++) {
ch = active_ch[i];

Check warning on line 647 in drivers/iio/adc/ad_pulsar.c

View workflow job for this annotation

GitHub Actions / build_llvm_x86_64 / build

clang_analyzer: Assigned value is garbage or undefined [core.uninitialized.Assign] 647 | ch = active_ch[i]; | ^
/*
* Configurations need to be sent prior to the acquisition.
*/
if (num_en_ch > 1) {
if (next_in_sequ >= num_en_ch)
next_in_sequ = 0;
next_active_ch = active_ch[next_in_sequ];

Check warning on line 654 in drivers/iio/adc/ad_pulsar.c

View workflow job for this annotation

GitHub Actions / build_llvm_x86_64 / build

clang_analyzer: Assigned value is garbage or undefined [core.uninitialized.Assign] 654 | next_active_ch = active_ch[next_in_sequ]; | ^
adc->seq_xfer[ch].tx_buf = &adc->cfg_reg[next_active_ch];
next_in_sequ++;
}
Expand All @@ -677,7 +676,7 @@

if (num_en_ch > 1)
return ad_pulsar_reg_write(adc, AD7682_REG_CONFIG,
adc->cfg_reg[second]);

Check failure on line 679 in drivers/iio/adc/ad_pulsar.c

View workflow job for this annotation

GitHub Actions / build_gcc_arm / build

kernel_smatch: uninitialized symbol 'second'.

return ad_pulsar_reg_write(adc, AD7682_REG_CONFIG,
adc->cfg_reg[first]);
Expand Down
2 changes: 1 addition & 1 deletion drivers/iio/adc/admc_adc.c
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@
struct axiadc_state *st = iio_priv(indio_dev);
unsigned i, ctrl;

for (i = 0; i < indio_dev->masklength; i++) {
for (i = 0; i < iio_get_masklength(indio_dev); i++) {
ctrl = axiadc_read(st, ADI_REG_CHAN_CNTRL(i));

if (test_bit(i, scan_mask))
Expand Down Expand Up @@ -216,7 +216,7 @@
static struct platform_driver axiadc_driver = {
.driver = {
.name = KBUILD_MODNAME,
.owner = THIS_MODULE,

Check warning on line 219 in drivers/iio/adc/admc_adc.c

View workflow job for this annotation

GitHub Actions / checks / checks

coccicheck: 3-8 No need to set .owner here. The core will do it.

Check warning on line 219 in drivers/iio/adc/admc_adc.c

View workflow job for this annotation

GitHub Actions / checks / checks

coccicheck: 3-8 No need to set .owner here. The core will do it.
.of_match_table = axiadc_of_match,
},
.probe = axiadc_probe,
Expand Down
2 changes: 1 addition & 1 deletion drivers/iio/adc/admc_speed.c
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@
unsigned num_channels;
const unsigned long *scan_masks;
unsigned int max_rate;
struct iio_chan_spec channel[1];

Check warning on line 64 in drivers/iio/adc/admc_speed.c

View workflow job for this annotation

GitHub Actions / checks / checks

coccicheck: 23-30 WARNING use flexible-array member instead (https //www.kernel.org/doc/html/latest/process/deprecated.html#zero-length-and-one-element-arrays)

Check warning on line 64 in drivers/iio/adc/admc_speed.c

View workflow job for this annotation

GitHub Actions / checks / checks

coccicheck: 23-30 WARNING use flexible-array member instead (https //www.kernel.org/doc/html/latest/process/deprecated.html#zero-length-and-one-element-arrays)
};

struct axiadc_state {
Expand Down Expand Up @@ -104,7 +104,7 @@
struct axiadc_state *st = iio_priv(indio_dev);
unsigned i, ctrl;

for (i = 0; i < indio_dev->masklength; i++) {
for (i = 0; i < iio_get_masklength(indio_dev); i++) {
ctrl = axiadc_read(st, ADI_REG_CHAN_CNTRL(i));

if (test_bit(i, scan_mask))
Expand Down Expand Up @@ -211,7 +211,7 @@
static struct platform_driver axiadc_of_driver = {
.driver = {
.name = KBUILD_MODNAME,
.owner = THIS_MODULE,

Check warning on line 214 in drivers/iio/adc/admc_speed.c

View workflow job for this annotation

GitHub Actions / checks / checks

coccicheck: 3-8 No need to set .owner here. The core will do it.

Check warning on line 214 in drivers/iio/adc/admc_speed.c

View workflow job for this annotation

GitHub Actions / checks / checks

coccicheck: 3-8 No need to set .owner here. The core will do it.
.of_match_table = axiadc_of_match,
},
.probe = axiadc_probe,
Expand Down
2 changes: 1 addition & 1 deletion drivers/iio/adc/cf_axi_adc_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@
stat = axiadc_read(st, ADI_REG_CHAN_STATUS(i));
axiadc_get_pnsel(st, i, &pn_name);

len += sprintf(buf + len, "CH%d : %s : %s %s\n", i, pn_name,

Check failure on line 168 in drivers/iio/adc/cf_axi_adc_core.c

View workflow job for this annotation

GitHub Actions / build_gcc_arm / build

kernel_smatch: uninitialized symbol 'pn_name'.
(stat & ADI_PN_OOS) ? "Out of Sync :" : "In Sync :",
(stat & (ADI_PN_ERR | ADI_PN_OOS)) ? "PN Error" : "OK");
axiadc_write(st, ADI_REG_CHAN_STATUS(i), ~0);
Expand Down Expand Up @@ -242,17 +242,17 @@
if (!(reg & DEBUGFS_DRA_PCORE_REG_MAGIC)) {
struct axiadc_converter *conv = to_converter(st->dev_spi);
if (IS_ERR(conv))
ret = PTR_ERR(conv);

Check warning on line 245 in drivers/iio/adc/cf_axi_adc_core.c

View workflow job for this annotation

GitHub Actions / build_llvm_x86_64 / build

clang_analyzer: Value stored to 'ret' is never read [deadcode.DeadStores] 245 | ret = PTR_ERR(conv); | ^ ~~~~~~~~~~~~~
else if (!conv->reg_access)
ret = -ENODEV;

Check warning on line 247 in drivers/iio/adc/cf_axi_adc_core.c

View workflow job for this annotation

GitHub Actions / build_llvm_x86_64 / build

clang_analyzer: Value stored to 'ret' is never read [deadcode.DeadStores] 247 | ret = -ENODEV; | ^ ~~~~~~~
else
ret = conv->reg_access(indio_dev, reg, writeval, readval);

Check warning on line 249 in drivers/iio/adc/cf_axi_adc_core.c

View workflow job for this annotation

GitHub Actions / build_llvm_x86_64 / build

clang_analyzer: Value stored to 'ret' is never read [deadcode.DeadStores] 249 | ret = conv->reg_access(indio_dev, reg, writeval, readval); | ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
} else {
if (readval == NULL)
axiadc_write(st, reg & 0xFFFF, writeval);
else
*readval = axiadc_read(st, reg & 0xFFFF);
ret = 0;

Check warning on line 255 in drivers/iio/adc/cf_axi_adc_core.c

View workflow job for this annotation

GitHub Actions / build_llvm_x86_64 / build

clang_analyzer: Value stored to 'ret' is never read [deadcode.DeadStores] 255 | ret = 0; | ^ ~
}
mutex_unlock(&conv->lock);

Expand Down Expand Up @@ -721,7 +721,7 @@
struct axiadc_state *st = iio_priv(indio_dev);
unsigned i, ctrl;

for (i = 0; i < indio_dev->masklength; i++) {
for (i = 0; i < iio_get_masklength(indio_dev); i++) {
if (i > (st->have_slave_channels - 1))
ctrl = axiadc_slave_read(st,
ADI_REG_CHAN_CNTRL(i - st->have_slave_channels));
Expand Down Expand Up @@ -1229,7 +1229,7 @@
static struct platform_driver axiadc_driver = {
.driver = {
.name = KBUILD_MODNAME,
.owner = THIS_MODULE,

Check warning on line 1232 in drivers/iio/adc/cf_axi_adc_core.c

View workflow job for this annotation

GitHub Actions / checks / checks

coccicheck: 3-8 No need to set .owner here. The core will do it.

Check warning on line 1232 in drivers/iio/adc/cf_axi_adc_core.c

View workflow job for this annotation

GitHub Actions / checks / checks

coccicheck: 3-8 No need to set .owner here. The core will do it.
.of_match_table = axiadc_of_match,
},
.probe = axiadc_probe,
Expand Down
2 changes: 1 addition & 1 deletion drivers/iio/dac/ad5686.c
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
// SPDX-License-Identifier: GPL-2.0
/*
* AD5686R, AD5685R, AD5684R Digital to analog converters driver
Expand Down Expand Up @@ -522,11 +522,11 @@
goto out;

mutex_lock(&st->lock);
for_each_set_bit(i, indio_dev->active_scan_mask, indio_dev->masklength) {
iio_for_each_active_channel(indio_dev, i) {
val = (sample[1] << 8) + sample[0];

chan = &indio_dev->channels[i];
ret = st->write(st, AD5686_CMD_WRITE_INPUT_N_UPDATE_N,

Check warning on line 529 in drivers/iio/dac/ad5686.c

View workflow job for this annotation

GitHub Actions / build_llvm_x86_64 / build

clang_analyzer: Value stored to 'ret' is never read [deadcode.DeadStores] 529 | ret = st->write(st, AD5686_CMD_WRITE_INPUT_N_UPDATE_N, | ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 530 | chan->address, val << chan->scan_type.shift); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
chan->address, val << chan->scan_type.shift);
}
mutex_unlock(&st->lock);
Expand Down Expand Up @@ -576,9 +576,9 @@
st->trig = devm_iio_trigger_alloc(dev, "%s-dev%d", name,
iio_device_id(indio_dev));
if (st->trig == NULL)
ret = -ENOMEM;

Check warning on line 579 in drivers/iio/dac/ad5686.c

View workflow job for this annotation

GitHub Actions / build_llvm_x86_64 / build

clang_analyzer: Value stored to 'ret' is never read [deadcode.DeadStores] 579 | ret = -ENOMEM; | ^ ~~~~~~~

st->trig->ops = &ad5686_trigger_ops;

Check failure on line 581 in drivers/iio/dac/ad5686.c

View workflow job for this annotation

GitHub Actions / build_gcc_arm / build

kernel_smatch: we previously assumed 'st->trig' could be null (see line 578)
st->trig->dev.parent = dev;
iio_trigger_set_drvdata(st->trig, indio_dev);

Expand Down Expand Up @@ -623,7 +623,7 @@
IRQF_TRIGGER_RISING | IRQF_ONESHOT,
"ad5686 irq", indio_dev);
if (ret)
return ret;

Check warning on line 626 in drivers/iio/dac/ad5686.c

View workflow job for this annotation

GitHub Actions / build_gcc_arm / build

kernel_smatch: missing unwind goto?

st->irq = irq;
}
Expand Down
6 changes: 2 additions & 4 deletions drivers/iio/dac/ad7303.c
Original file line number Diff line number Diff line change
Expand Up @@ -78,9 +78,7 @@ static irqreturn_t ad7303_trigger_handler(int irq, void *p)
goto out;

j = 0;
for_each_set_bit(i,
indio_dev->active_scan_mask,
indio_dev->masklength) {
iio_for_each_active_channel(indio_dev, i) {
st->dac_cache[i] = sample[j];
val = AD7303_CMD_UPDATE_INPUT |
(i << AD7303_CFG_ADDR_OFFSET) |
Expand All @@ -105,7 +103,7 @@ static int ad7303_update_scan_mode(struct iio_dev *indio_dev,
struct ad7303_state *st = iio_priv(indio_dev);
int i;

st->num_transfers = bitmap_weight(scan_mask, indio_dev->masklength);
st->num_transfers = bitmap_weight(scan_mask, iio_get_masklength(indio_dev));

spi_message_init(&st->msg);

Expand Down
2 changes: 1 addition & 1 deletion drivers/iio/frequency/cf_axi_dds.c
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@
}

val64 = (unsigned long long)val2 * 0x4000UL + (1000000UL / 2);
do_div(val64, 1000000UL);

Check warning on line 230 in drivers/iio/frequency/cf_axi_dds.c

View workflow job for this annotation

GitHub Actions / build_gcc_arm / build

kernel_smatch: inconsistent indenting

*res = i | val64;

Expand Down Expand Up @@ -321,7 +321,7 @@
*freq = st->dac_clk = clk_get_rate_scaled(st->clk, &st->clkscale);
} else {
conv = to_converter(st->dev_spi);
if (!conv->get_data_clk)

Check failure on line 324 in drivers/iio/frequency/cf_axi_dds.c

View workflow job for this annotation

GitHub Actions / build_gcc_arm / build

kernel_smatch: 'conv' dereferencing possible ERR_PTR()
return -ENODEV;

*freq = st->dac_clk = conv->get_data_clk(conv);
Expand Down Expand Up @@ -401,7 +401,7 @@
return 0;

conv = to_converter(st->dev_spi);
if (conv->get_fifo_status) {

Check failure on line 404 in drivers/iio/frequency/cf_axi_dds.c

View workflow job for this annotation

GitHub Actions / build_gcc_arm / build

kernel_smatch: 'conv' dereferencing possible ERR_PTR()
/* Check FIFO status */
stat = conv->get_fifo_status(conv);
if (stat) {
Expand Down Expand Up @@ -718,7 +718,7 @@
if (chan->type == IIO_VOLTAGE) {
if (!st->standalone) {
conv = to_converter(st->dev_spi);
if (!conv->read_raw) {

Check failure on line 721 in drivers/iio/frequency/cf_axi_dds.c

View workflow job for this annotation

GitHub Actions / build_gcc_arm / build

kernel_smatch: 'conv' dereferencing possible ERR_PTR()
ret = -ENODEV;
} else {
ret = conv->read_raw(indio_dev, chan,
Expand Down Expand Up @@ -780,7 +780,7 @@
default:
if (!st->standalone) {
conv = to_converter(st->dev_spi);
if (!conv->read_raw) {

Check failure on line 783 in drivers/iio/frequency/cf_axi_dds.c

View workflow job for this annotation

GitHub Actions / build_gcc_arm / build

kernel_smatch: 'conv' dereferencing possible ERR_PTR()
ret = -ENODEV;
} else {
ret = conv->read_raw(indio_dev, chan,
Expand Down Expand Up @@ -1041,7 +1041,7 @@
struct cf_axi_dds_state *st = iio_priv(indio_dev);
unsigned int i, sel;

for (i = 0; i < indio_dev->masklength; i++) {
for (i = 0; i < iio_get_masklength(indio_dev); i++) {

if (test_bit(i, scan_mask))
sel = DATA_SEL_DMA;
Expand Down Expand Up @@ -1950,10 +1950,10 @@
for (i = 0; i < 2 * m; i++, c++) {
if (c > ARRAY_SIZE(st->chip_info_generated.channel))
return -EINVAL;
st->chip_info_generated.channel[c].type =

Check failure on line 1953 in drivers/iio/frequency/cf_axi_dds.c

View workflow job for this annotation

GitHub Actions / build_gcc_arm / build

kernel_smatch: buffer overflow 'st->chip_info_generated.channel' 192 <= 192
IIO_ALTVOLTAGE;
st->chip_info_generated.channel[c].output = 1;

Check failure on line 1955 in drivers/iio/frequency/cf_axi_dds.c

View workflow job for this annotation

GitHub Actions / build_gcc_arm / build

kernel_smatch: buffer overflow 'st->chip_info_generated.channel' 192 <= 192
st->chip_info_generated.channel[c].indexed = 1;

Check failure on line 1956 in drivers/iio/frequency/cf_axi_dds.c

View workflow job for this annotation

GitHub Actions / build_gcc_arm / build

kernel_smatch: buffer overflow 'st->chip_info_generated.channel' 192 <= 192
st->chip_info_generated.channel[c].channel = i;
st->chip_info_generated.channel[c].scan_index = -1;
st->chip_info_generated.channel
Expand Down Expand Up @@ -2664,7 +2664,7 @@
static struct platform_driver cf_axi_dds_driver = {
.driver = {
.name = "cf_axi_dds",
.owner = THIS_MODULE,

Check warning on line 2667 in drivers/iio/frequency/cf_axi_dds.c

View workflow job for this annotation

GitHub Actions / checks / checks

coccicheck: 3-8 No need to set .owner here. The core will do it.

Check warning on line 2667 in drivers/iio/frequency/cf_axi_dds.c

View workflow job for this annotation

GitHub Actions / checks / checks

coccicheck: 3-8 No need to set .owner here. The core will do it.
.of_match_table = cf_axi_dds_of_match,
},
.probe = cf_axi_dds_probe,
Expand Down
Loading