Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge tag 'staging-5.13-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging

Pull staging and IIO driver fixes from Greg KH:
"Here are some small IIO and staging driver fixes for reported issues
for 5.13-rc4.

Nothing major here, tiny changes for reported problems, full details
are in the shortlog if people are curious.

All have been in linux-next for a while with no reported problems"

* tag 'staging-5.13-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging:
iio: adc: ad7793: Add missing error code in ad7793_setup()
iio: adc: ad7923: Fix undersized rx buffer.
iio: adc: ad7768-1: Fix too small buffer passed to iio_push_to_buffers_with_timestamp()
iio: dac: ad5770r: Put fwnode in error case during ->probe()
iio: gyro: fxas21002c: balance runtime power in error path
staging: emxx_udc: fix loop in _nbu2ss_nuke()
staging: iio: cdc: ad7746: avoid overwrite of num_channels
iio: adc: ad7192: handle regulator voltage error first
iio: adc: ad7192: Avoid disabling a clock that was never enabled.
iio: adc: ad7124: Fix potential overflow due to non sequential channel numbers
iio: adc: ad7124: Fix missbalanced regulator enable / disable on error.

+55 -36
+20 -16
drivers/iio/adc/ad7124.c
··· 771 771 if (ret) 772 772 goto err; 773 773 774 + if (channel >= indio_dev->num_channels) { 775 + dev_err(indio_dev->dev.parent, 776 + "Channel index >= number of channels\n"); 777 + ret = -EINVAL; 778 + goto err; 779 + } 780 + 774 781 ret = of_property_read_u32_array(child, "diff-channels", 775 782 ain, 2); 776 783 if (ret) ··· 857 850 return ret; 858 851 } 859 852 853 + static void ad7124_reg_disable(void *r) 854 + { 855 + regulator_disable(r); 856 + } 857 + 860 858 static int ad7124_probe(struct spi_device *spi) 861 859 { 862 860 const struct ad7124_chip_info *info; ··· 907 895 ret = regulator_enable(st->vref[i]); 908 896 if (ret) 909 897 return ret; 898 + 899 + ret = devm_add_action_or_reset(&spi->dev, ad7124_reg_disable, 900 + st->vref[i]); 901 + if (ret) 902 + return ret; 910 903 } 911 904 912 905 st->mclk = devm_clk_get(&spi->dev, "mclk"); 913 - if (IS_ERR(st->mclk)) { 914 - ret = PTR_ERR(st->mclk); 915 - goto error_regulator_disable; 916 - } 906 + if (IS_ERR(st->mclk)) 907 + return PTR_ERR(st->mclk); 917 908 918 909 ret = clk_prepare_enable(st->mclk); 919 910 if (ret < 0) 920 - goto error_regulator_disable; 911 + return ret; 921 912 922 913 ret = ad7124_soft_reset(st); 923 914 if (ret < 0) ··· 950 935 ad_sd_cleanup_buffer_and_trigger(indio_dev); 951 936 error_clk_disable_unprepare: 952 937 clk_disable_unprepare(st->mclk); 953 - error_regulator_disable: 954 - for (i = ARRAY_SIZE(st->vref) - 1; i >= 0; i--) { 955 - if (!IS_ERR_OR_NULL(st->vref[i])) 956 - regulator_disable(st->vref[i]); 957 - } 958 938 959 939 return ret; 960 940 } ··· 958 948 { 959 949 struct iio_dev *indio_dev = spi_get_drvdata(spi); 960 950 struct ad7124_state *st = iio_priv(indio_dev); 961 - int i; 962 951 963 952 iio_device_unregister(indio_dev); 964 953 ad_sd_cleanup_buffer_and_trigger(indio_dev); 965 954 clk_disable_unprepare(st->mclk); 966 - 967 - for (i = ARRAY_SIZE(st->vref) - 1; i >= 0; i--) { 968 - if (!IS_ERR_OR_NULL(st->vref[i])) 969 - regulator_disable(st->vref[i]); 970 - } 971 955 972 956 return 0; 973 957 }
+10 -9
drivers/iio/adc/ad7192.c
··· 912 912 { 913 913 struct ad7192_state *st; 914 914 struct iio_dev *indio_dev; 915 - int ret, voltage_uv = 0; 915 + int ret; 916 916 917 917 if (!spi->irq) { 918 918 dev_err(&spi->dev, "no IRQ?\n"); ··· 949 949 goto error_disable_avdd; 950 950 } 951 951 952 - voltage_uv = regulator_get_voltage(st->avdd); 953 - 954 - if (voltage_uv > 0) { 955 - st->int_vref_mv = voltage_uv / 1000; 956 - } else { 957 - ret = voltage_uv; 952 + ret = regulator_get_voltage(st->avdd); 953 + if (ret < 0) { 958 954 dev_err(&spi->dev, "Device tree error, reference voltage undefined\n"); 959 955 goto error_disable_avdd; 960 956 } 957 + st->int_vref_mv = ret / 1000; 961 958 962 959 spi_set_drvdata(spi, indio_dev); 963 960 st->chip_info = of_device_get_match_data(&spi->dev); ··· 1011 1014 return 0; 1012 1015 1013 1016 error_disable_clk: 1014 - clk_disable_unprepare(st->mclk); 1017 + if (st->clock_sel == AD7192_CLK_EXT_MCLK1_2 || 1018 + st->clock_sel == AD7192_CLK_EXT_MCLK2) 1019 + clk_disable_unprepare(st->mclk); 1015 1020 error_remove_trigger: 1016 1021 ad_sd_cleanup_buffer_and_trigger(indio_dev); 1017 1022 error_disable_dvdd: ··· 1030 1031 struct ad7192_state *st = iio_priv(indio_dev); 1031 1032 1032 1033 iio_device_unregister(indio_dev); 1033 - clk_disable_unprepare(st->mclk); 1034 + if (st->clock_sel == AD7192_CLK_EXT_MCLK1_2 || 1035 + st->clock_sel == AD7192_CLK_EXT_MCLK2) 1036 + clk_disable_unprepare(st->mclk); 1034 1037 ad_sd_cleanup_buffer_and_trigger(indio_dev); 1035 1038 1036 1039 regulator_disable(st->dvdd);
+6 -2
drivers/iio/adc/ad7768-1.c
··· 167 167 * transfer buffers to live in their own cache lines. 168 168 */ 169 169 union { 170 + struct { 171 + __be32 chan; 172 + s64 timestamp; 173 + } scan; 170 174 __be32 d32; 171 175 u8 d8[2]; 172 176 } data ____cacheline_aligned; ··· 473 469 474 470 mutex_lock(&st->lock); 475 471 476 - ret = spi_read(st->spi, &st->data.d32, 3); 472 + ret = spi_read(st->spi, &st->data.scan.chan, 3); 477 473 if (ret < 0) 478 474 goto err_unlock; 479 475 480 - iio_push_to_buffers_with_timestamp(indio_dev, &st->data.d32, 476 + iio_push_to_buffers_with_timestamp(indio_dev, &st->data.scan, 481 477 iio_get_time_ns(indio_dev)); 482 478 483 479 iio_trigger_notify_done(indio_dev->trig);
+1
drivers/iio/adc/ad7793.c
··· 279 279 id &= AD7793_ID_MASK; 280 280 281 281 if (id != st->chip_info->id) { 282 + ret = -ENODEV; 282 283 dev_err(&st->sd.spi->dev, "device ID query failed\n"); 283 284 goto out; 284 285 }
+3 -1
drivers/iio/adc/ad7923.c
··· 59 59 /* 60 60 * DMA (thus cache coherency maintenance) requires the 61 61 * transfer buffers to live in their own cache lines. 62 + * Ensure rx_buf can be directly used in iio_push_to_buffers_with_timetamp 63 + * Length = 8 channels + 4 extra for 8 byte timestamp 62 64 */ 63 - __be16 rx_buf[4] ____cacheline_aligned; 65 + __be16 rx_buf[12] ____cacheline_aligned; 64 66 __be16 tx_buf[4]; 65 67 }; 66 68
+11 -5
drivers/iio/dac/ad5770r.c
··· 524 524 device_for_each_child_node(&st->spi->dev, child) { 525 525 ret = fwnode_property_read_u32(child, "num", &num); 526 526 if (ret) 527 - return ret; 528 - if (num >= AD5770R_MAX_CHANNELS) 529 - return -EINVAL; 527 + goto err_child_out; 528 + if (num >= AD5770R_MAX_CHANNELS) { 529 + ret = -EINVAL; 530 + goto err_child_out; 531 + } 530 532 531 533 ret = fwnode_property_read_u32_array(child, 532 534 "adi,range-microamp", 533 535 tmp, 2); 534 536 if (ret) 535 - return ret; 537 + goto err_child_out; 536 538 537 539 min = tmp[0] / 1000; 538 540 max = tmp[1] / 1000; 539 541 ret = ad5770r_store_output_range(st, min, max, num); 540 542 if (ret) 541 - return ret; 543 + goto err_child_out; 542 544 } 543 545 546 + return 0; 547 + 548 + err_child_out: 549 + fwnode_handle_put(child); 544 550 return ret; 545 551 } 546 552
+2
drivers/iio/gyro/fxas21002c_core.c
··· 399 399 ret = regmap_field_read(data->regmap_fields[F_TEMP], &temp); 400 400 if (ret < 0) { 401 401 dev_err(dev, "failed to read temp: %d\n", ret); 402 + fxas21002c_pm_put(data); 402 403 goto data_unlock; 403 404 } 404 405 ··· 433 432 &axis_be, sizeof(axis_be)); 434 433 if (ret < 0) { 435 434 dev_err(dev, "failed to read axis: %d: %d\n", index, ret); 435 + fxas21002c_pm_put(data); 436 436 goto data_unlock; 437 437 } 438 438
+2 -2
drivers/staging/emxx_udc/emxx_udc.c
··· 2064 2064 struct nbu2ss_ep *ep, 2065 2065 int status) 2066 2066 { 2067 - struct nbu2ss_req *req; 2067 + struct nbu2ss_req *req, *n; 2068 2068 2069 2069 /* Endpoint Disable */ 2070 2070 _nbu2ss_epn_exit(udc, ep); ··· 2076 2076 return 0; 2077 2077 2078 2078 /* called with irqs blocked */ 2079 - list_for_each_entry(req, &ep->queue, queue) { 2079 + list_for_each_entry_safe(req, n, &ep->queue, queue) { 2080 2080 _nbu2ss_ep_done(ep, req, status); 2081 2081 } 2082 2082
-1
drivers/staging/iio/cdc/ad7746.c
··· 700 700 indio_dev->num_channels = ARRAY_SIZE(ad7746_channels); 701 701 else 702 702 indio_dev->num_channels = ARRAY_SIZE(ad7746_channels) - 2; 703 - indio_dev->num_channels = ARRAY_SIZE(ad7746_channels); 704 703 indio_dev->modes = INDIO_DIRECT_MODE; 705 704 706 705 if (pdata) {