From 6e14df24a4bb8a69350f824ec59335e356a49358 Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Mon, 26 Jul 2021 11:36:10 +0200 Subject: [PATCH] 4.14-stable patches added patches: btrfs-compression-don-t-try-to-compress-if-we-don-t-have-enough-pages.patch iio-accel-bma180-fix-bma25x-bandwidth-register-values.patch iio-accel-bma180-use-explicit-member-assignment.patch spi-spi-fsl-dspi-fix-a-resource-leak-in-an-error-handling-path.patch --- ...mpress-if-we-don-t-have-enough-pages.patch | 39 +++++++ ...fix-bma25x-bandwidth-register-values.patch | 77 +++++++++++++ ...ma180-use-explicit-member-assignment.patch | 102 ++++++++++++++++++ queue-4.14/series | 4 + ...ource-leak-in-an-error-handling-path.patch | 42 ++++++++ 5 files changed, 264 insertions(+) create mode 100644 queue-4.14/btrfs-compression-don-t-try-to-compress-if-we-don-t-have-enough-pages.patch create mode 100644 queue-4.14/iio-accel-bma180-fix-bma25x-bandwidth-register-values.patch create mode 100644 queue-4.14/iio-accel-bma180-use-explicit-member-assignment.patch create mode 100644 queue-4.14/spi-spi-fsl-dspi-fix-a-resource-leak-in-an-error-handling-path.patch diff --git a/queue-4.14/btrfs-compression-don-t-try-to-compress-if-we-don-t-have-enough-pages.patch b/queue-4.14/btrfs-compression-don-t-try-to-compress-if-we-don-t-have-enough-pages.patch new file mode 100644 index 00000000000..457fe4edca0 --- /dev/null +++ b/queue-4.14/btrfs-compression-don-t-try-to-compress-if-we-don-t-have-enough-pages.patch @@ -0,0 +1,39 @@ +From foo@baz Mon Jul 26 11:33:25 AM CEST 2021 +From: David Sterba +Date: Mon, 14 Jun 2021 12:45:18 +0200 +Subject: btrfs: compression: don't try to compress if we don't have enough pages + +From: David Sterba + +commit f2165627319ffd33a6217275e5690b1ab5c45763 upstream + +The early check if we should attempt compression does not take into +account the number of input pages. It can happen that there's only one +page, eg. a tail page after some ranges of the BTRFS_MAX_UNCOMPRESSED +have been processed, or an isolated page that won't be converted to an +inline extent. + +The single page would be compressed but a later check would drop it +again because the result size must be at least one block shorter than +the input. That can never work with just one page. + +CC: stable@vger.kernel.org # 4.4+ +Signed-off-by: David Sterba +[sudip: adjust context] +Signed-off-by: Sudip Mukherjee +Signed-off-by: Greg Kroah-Hartman +--- + fs/btrfs/inode.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/fs/btrfs/inode.c ++++ b/fs/btrfs/inode.c +@@ -540,7 +540,7 @@ again: + * inode has not been flagged as nocompress. This flag can + * change at any time if we discover bad compression ratios. + */ +- if (inode_need_compress(inode, start, end)) { ++ if (nr_pages > 1 && inode_need_compress(inode, start, end)) { + WARN_ON(pages); + pages = kcalloc(nr_pages, sizeof(struct page *), GFP_NOFS); + if (!pages) { diff --git a/queue-4.14/iio-accel-bma180-fix-bma25x-bandwidth-register-values.patch b/queue-4.14/iio-accel-bma180-fix-bma25x-bandwidth-register-values.patch new file mode 100644 index 00000000000..23f60ba85dd --- /dev/null +++ b/queue-4.14/iio-accel-bma180-fix-bma25x-bandwidth-register-values.patch @@ -0,0 +1,77 @@ +From foo@baz Mon Jul 26 11:32:24 AM CEST 2021 +From: Stephan Gerhold +Date: Wed, 26 May 2021 11:44:07 +0200 +Subject: iio: accel: bma180: Fix BMA25x bandwidth register values + +From: Stephan Gerhold + +commit 8090d67421ddab0ae932abab5a60200598bf0bbb upstream + +According to the BMA253 datasheet [1] and BMA250 datasheet [2] the +bandwidth value for BMA25x should be set as 01xxx: + + "Settings 00xxx result in a bandwidth of 7.81 Hz; [...] + It is recommended [...] to use the range from ´01000b´ to ´01111b´ + only in order to be compatible with future products." + +However, at the moment the drivers sets bandwidth values from 0 to 6, +which is not recommended and always results into 7.81 Hz bandwidth +according to the datasheet. + +Fix this by introducing a bw_offset = 8 = 01000b for BMA25x, +so the additional bit is always set for BMA25x. + +[1]: https://www.bosch-sensortec.com/media/boschsensortec/downloads/datasheets/bst-bma253-ds000.pdf +[2]: https://datasheet.octopart.com/BMA250-Bosch-datasheet-15540103.pdf + +Cc: Peter Meerwald +Fixes: 2017cff24cc0 ("iio:bma180: Add BMA250 chip support") +Signed-off-by: Stephan Gerhold +Reviewed-by: Linus Walleij +Link: https://lore.kernel.org/r/20210526094408.34298-2-stephan@gerhold.net +Cc: +Signed-off-by: Jonathan Cameron +[sudip: adjust context] +Signed-off-by: Sudip Mukherjee +Signed-off-by: Greg Kroah-Hartman +--- + drivers/iio/accel/bma180.c | 7 +++++-- + 1 file changed, 5 insertions(+), 2 deletions(-) + +--- a/drivers/iio/accel/bma180.c ++++ b/drivers/iio/accel/bma180.c +@@ -50,7 +50,7 @@ struct bma180_part_info { + + u8 int_reset_reg, int_reset_mask; + u8 sleep_reg, sleep_mask; +- u8 bw_reg, bw_mask; ++ u8 bw_reg, bw_mask, bw_offset; + u8 scale_reg, scale_mask; + u8 power_reg, power_mask, lowpower_val; + u8 int_enable_reg, int_enable_mask; +@@ -106,6 +106,7 @@ struct bma180_part_info { + + #define BMA250_RANGE_MASK GENMASK(3, 0) /* Range of accel values */ + #define BMA250_BW_MASK GENMASK(4, 0) /* Accel bandwidth */ ++#define BMA250_BW_OFFSET 8 + #define BMA250_SUSPEND_MASK BIT(7) /* chip will sleep */ + #define BMA250_LOWPOWER_MASK BIT(6) + #define BMA250_DATA_INTEN_MASK BIT(4) +@@ -243,7 +244,8 @@ static int bma180_set_bw(struct bma180_d + for (i = 0; i < data->part_info->num_bw; ++i) { + if (data->part_info->bw_table[i] == val) { + ret = bma180_set_bits(data, data->part_info->bw_reg, +- data->part_info->bw_mask, i); ++ data->part_info->bw_mask, ++ i + data->part_info->bw_offset); + if (ret) { + dev_err(&data->client->dev, + "failed to set bandwidth\n"); +@@ -662,6 +664,7 @@ static const struct bma180_part_info bma + .sleep_mask = BMA250_SUSPEND_MASK, + .bw_reg = BMA250_BW_REG, + .bw_mask = BMA250_BW_MASK, ++ .bw_offset = BMA250_BW_OFFSET, + .scale_reg = BMA250_RANGE_REG, + .scale_mask = BMA250_RANGE_MASK, + .power_reg = BMA250_POWER_REG, diff --git a/queue-4.14/iio-accel-bma180-use-explicit-member-assignment.patch b/queue-4.14/iio-accel-bma180-use-explicit-member-assignment.patch new file mode 100644 index 00000000000..ec727602e1a --- /dev/null +++ b/queue-4.14/iio-accel-bma180-use-explicit-member-assignment.patch @@ -0,0 +1,102 @@ +From foo@baz Mon Jul 26 11:32:24 AM CEST 2021 +From: Linus Walleij +Date: Wed, 11 Dec 2019 22:38:18 +0100 +Subject: iio: accel: bma180: Use explicit member assignment + +From: Linus Walleij + +commit 9436abc40139503a7cea22a96437697d048f31c0 upstream + +This uses the C99 explicit .member assignment for the +variant data in struct bma180_part_info. This makes it +easier to understand and add new variants. + +Cc: Peter Meerwald +Cc: Oleksandr Kravchenko +Signed-off-by: Linus Walleij +Signed-off-by: Jonathan Cameron +Signed-off-by: Sudip Mukherjee +Signed-off-by: Greg Kroah-Hartman +--- + drivers/iio/accel/bma180.c | 68 +++++++++++++++++++++++++++++---------------- + 1 file changed, 44 insertions(+), 24 deletions(-) + +--- a/drivers/iio/accel/bma180.c ++++ b/drivers/iio/accel/bma180.c +@@ -626,32 +626,52 @@ static const struct iio_chan_spec bma250 + + static const struct bma180_part_info bma180_part_info[] = { + [BMA180] = { +- bma180_channels, ARRAY_SIZE(bma180_channels), +- bma180_scale_table, ARRAY_SIZE(bma180_scale_table), +- bma180_bw_table, ARRAY_SIZE(bma180_bw_table), +- BMA180_CTRL_REG0, BMA180_RESET_INT, +- BMA180_CTRL_REG0, BMA180_SLEEP, +- BMA180_BW_TCS, BMA180_BW, +- BMA180_OFFSET_LSB1, BMA180_RANGE, +- BMA180_TCO_Z, BMA180_MODE_CONFIG, BMA180_LOW_POWER, +- BMA180_CTRL_REG3, BMA180_NEW_DATA_INT, +- BMA180_RESET, +- bma180_chip_config, +- bma180_chip_disable, ++ .channels = bma180_channels, ++ .num_channels = ARRAY_SIZE(bma180_channels), ++ .scale_table = bma180_scale_table, ++ .num_scales = ARRAY_SIZE(bma180_scale_table), ++ .bw_table = bma180_bw_table, ++ .num_bw = ARRAY_SIZE(bma180_bw_table), ++ .int_reset_reg = BMA180_CTRL_REG0, ++ .int_reset_mask = BMA180_RESET_INT, ++ .sleep_reg = BMA180_CTRL_REG0, ++ .sleep_mask = BMA180_SLEEP, ++ .bw_reg = BMA180_BW_TCS, ++ .bw_mask = BMA180_BW, ++ .scale_reg = BMA180_OFFSET_LSB1, ++ .scale_mask = BMA180_RANGE, ++ .power_reg = BMA180_TCO_Z, ++ .power_mask = BMA180_MODE_CONFIG, ++ .lowpower_val = BMA180_LOW_POWER, ++ .int_enable_reg = BMA180_CTRL_REG3, ++ .int_enable_mask = BMA180_NEW_DATA_INT, ++ .softreset_reg = BMA180_RESET, ++ .chip_config = bma180_chip_config, ++ .chip_disable = bma180_chip_disable, + }, + [BMA250] = { +- bma250_channels, ARRAY_SIZE(bma250_channels), +- bma250_scale_table, ARRAY_SIZE(bma250_scale_table), +- bma250_bw_table, ARRAY_SIZE(bma250_bw_table), +- BMA250_INT_RESET_REG, BMA250_INT_RESET_MASK, +- BMA250_POWER_REG, BMA250_SUSPEND_MASK, +- BMA250_BW_REG, BMA250_BW_MASK, +- BMA250_RANGE_REG, BMA250_RANGE_MASK, +- BMA250_POWER_REG, BMA250_LOWPOWER_MASK, 1, +- BMA250_INT_ENABLE_REG, BMA250_DATA_INTEN_MASK, +- BMA250_RESET_REG, +- bma250_chip_config, +- bma250_chip_disable, ++ .channels = bma250_channels, ++ .num_channels = ARRAY_SIZE(bma250_channels), ++ .scale_table = bma250_scale_table, ++ .num_scales = ARRAY_SIZE(bma250_scale_table), ++ .bw_table = bma250_bw_table, ++ .num_bw = ARRAY_SIZE(bma250_bw_table), ++ .int_reset_reg = BMA250_INT_RESET_REG, ++ .int_reset_mask = BMA250_INT_RESET_MASK, ++ .sleep_reg = BMA250_POWER_REG, ++ .sleep_mask = BMA250_SUSPEND_MASK, ++ .bw_reg = BMA250_BW_REG, ++ .bw_mask = BMA250_BW_MASK, ++ .scale_reg = BMA250_RANGE_REG, ++ .scale_mask = BMA250_RANGE_MASK, ++ .power_reg = BMA250_POWER_REG, ++ .power_mask = BMA250_LOWPOWER_MASK, ++ .lowpower_val = 1, ++ .int_enable_reg = BMA250_INT_ENABLE_REG, ++ .int_enable_mask = BMA250_DATA_INTEN_MASK, ++ .softreset_reg = BMA250_RESET_REG, ++ .chip_config = bma250_chip_config, ++ .chip_disable = bma250_chip_disable, + }, + }; + diff --git a/queue-4.14/series b/queue-4.14/series index 5280bd768fc..50af852811e 100644 --- a/queue-4.14/series +++ b/queue-4.14/series @@ -75,3 +75,7 @@ ixgbe-fix-packet-corruption-due-to-missing-dma-sync.patch selftest-use-mmap-instead-of-posix_memalign-to-allocate-memory.patch drm-return-enotty-for-non-drm-ioctls.patch net-bcmgenet-ensure-ext_energy_det_mask-is-clear.patch +iio-accel-bma180-use-explicit-member-assignment.patch +iio-accel-bma180-fix-bma25x-bandwidth-register-values.patch +btrfs-compression-don-t-try-to-compress-if-we-don-t-have-enough-pages.patch +spi-spi-fsl-dspi-fix-a-resource-leak-in-an-error-handling-path.patch diff --git a/queue-4.14/spi-spi-fsl-dspi-fix-a-resource-leak-in-an-error-handling-path.patch b/queue-4.14/spi-spi-fsl-dspi-fix-a-resource-leak-in-an-error-handling-path.patch new file mode 100644 index 00000000000..5da70bdc21b --- /dev/null +++ b/queue-4.14/spi-spi-fsl-dspi-fix-a-resource-leak-in-an-error-handling-path.patch @@ -0,0 +1,42 @@ +From foo@baz Mon Jul 26 11:35:06 AM CEST 2021 +From: Christophe JAILLET +Date: Sun, 9 May 2021 21:12:27 +0200 +Subject: spi: spi-fsl-dspi: Fix a resource leak in an error handling path + +From: Christophe JAILLET + +commit 680ec0549a055eb464dce6ffb4bfb736ef87236e upstream + +'dspi_request_dma()' should be undone by a 'dspi_release_dma()' call in the +error handling path of the probe function, as already done in the remove +function + +Fixes: 90ba37033cb9 ("spi: spi-fsl-dspi: Add DMA support for Vybrid") +Signed-off-by: Christophe JAILLET +Reviewed-by: Vladimir Oltean +Link: https://lore.kernel.org/r/d51caaac747277a1099ba8dea07acd85435b857e.1620587472.git.christophe.jaillet@wanadoo.fr +Signed-off-by: Mark Brown +[sudip: adjust context] +Signed-off-by: Sudip Mukherjee +Signed-off-by: Greg Kroah-Hartman +--- + drivers/spi/spi-fsl-dspi.c | 4 +++- + 1 file changed, 3 insertions(+), 1 deletion(-) + +--- a/drivers/spi/spi-fsl-dspi.c ++++ b/drivers/spi/spi-fsl-dspi.c +@@ -1057,11 +1057,13 @@ static int dspi_probe(struct platform_de + ret = spi_register_master(master); + if (ret != 0) { + dev_err(&pdev->dev, "Problem registering DSPI master\n"); +- goto out_free_irq; ++ goto out_release_dma; + } + + return ret; + ++out_release_dma: ++ dspi_release_dma(dspi); + out_free_irq: + if (dspi->irq) + free_irq(dspi->irq, dspi); -- 2.47.3