From: Sasha Levin Date: Mon, 25 Sep 2023 11:23:33 +0000 (-0400) Subject: Fixes for 5.15 X-Git-Tag: v6.5.6~95 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=63368166186e8ee661e7abfa795e9c64895296c1;p=thirdparty%2Fkernel%2Fstable-queue.git Fixes for 5.15 Signed-off-by: Sasha Levin --- diff --git a/queue-5.15/gpio-tb10x-fix-an-error-handling-path-in-tb10x_gpio_.patch b/queue-5.15/gpio-tb10x-fix-an-error-handling-path-in-tb10x_gpio_.patch new file mode 100644 index 00000000000..63b6975a2d0 --- /dev/null +++ b/queue-5.15/gpio-tb10x-fix-an-error-handling-path-in-tb10x_gpio_.patch @@ -0,0 +1,48 @@ +From 7f14239b53b76c8fb8400e21b9a5efe4ab106343 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Sun, 3 Sep 2023 08:13:21 +0200 +Subject: gpio: tb10x: Fix an error handling path in tb10x_gpio_probe() + +From: Christophe JAILLET + +[ Upstream commit b547b5e52a0587e6b25ea520bf2f9e03d00cbcb6 ] + +If an error occurs after a successful irq_domain_add_linear() call, it +should be undone by a corresponding irq_domain_remove(), as already done +in the remove function. + +Fixes: c6ce2b6bffe5 ("gpio: add TB10x GPIO driver") +Signed-off-by: Christophe JAILLET +Signed-off-by: Bartosz Golaszewski +Signed-off-by: Sasha Levin +--- + drivers/gpio/gpio-tb10x.c | 6 +++++- + 1 file changed, 5 insertions(+), 1 deletion(-) + +diff --git a/drivers/gpio/gpio-tb10x.c b/drivers/gpio/gpio-tb10x.c +index de6afa3f97168..05357473d2a11 100644 +--- a/drivers/gpio/gpio-tb10x.c ++++ b/drivers/gpio/gpio-tb10x.c +@@ -195,7 +195,7 @@ static int tb10x_gpio_probe(struct platform_device *pdev) + handle_edge_irq, IRQ_NOREQUEST, IRQ_NOPROBE, + IRQ_GC_INIT_MASK_CACHE); + if (ret) +- return ret; ++ goto err_remove_domain; + + gc = tb10x_gpio->domain->gc->gc[0]; + gc->reg_base = tb10x_gpio->base; +@@ -209,6 +209,10 @@ static int tb10x_gpio_probe(struct platform_device *pdev) + } + + return 0; ++ ++err_remove_domain: ++ irq_domain_remove(tb10x_gpio->domain); ++ return ret; + } + + static int tb10x_gpio_remove(struct platform_device *pdev) +-- +2.40.1 + diff --git a/queue-5.15/i2c-mux-demux-pinctrl-check-the-return-value-of-devm.patch b/queue-5.15/i2c-mux-demux-pinctrl-check-the-return-value-of-devm.patch new file mode 100644 index 00000000000..9307defa73a --- /dev/null +++ b/queue-5.15/i2c-mux-demux-pinctrl-check-the-return-value-of-devm.patch @@ -0,0 +1,38 @@ +From 9f362ca52383691b0a96604ea33dc058c479f047 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 3 Mar 2022 20:39:14 +0800 +Subject: i2c: mux: demux-pinctrl: check the return value of devm_kstrdup() + +From: Xiaoke Wang + +[ Upstream commit 7c0195fa9a9e263df204963f88a22b21688ffb66 ] + +devm_kstrdup() returns pointer to allocated string on success, +NULL on failure. So it is better to check the return value of it. + +Fixes: e35478eac030 ("i2c: mux: demux-pinctrl: run properly with multiple instances") +Signed-off-by: Xiaoke Wang +Signed-off-by: Wolfram Sang +Signed-off-by: Sasha Levin +--- + drivers/i2c/muxes/i2c-demux-pinctrl.c | 4 ++++ + 1 file changed, 4 insertions(+) + +diff --git a/drivers/i2c/muxes/i2c-demux-pinctrl.c b/drivers/i2c/muxes/i2c-demux-pinctrl.c +index f7a7405d4350a..8e8688e8de0fb 100644 +--- a/drivers/i2c/muxes/i2c-demux-pinctrl.c ++++ b/drivers/i2c/muxes/i2c-demux-pinctrl.c +@@ -243,6 +243,10 @@ static int i2c_demux_pinctrl_probe(struct platform_device *pdev) + + props[i].name = devm_kstrdup(&pdev->dev, "status", GFP_KERNEL); + props[i].value = devm_kstrdup(&pdev->dev, "ok", GFP_KERNEL); ++ if (!props[i].name || !props[i].value) { ++ err = -ENOMEM; ++ goto err_rollback; ++ } + props[i].length = 3; + + of_changeset_init(&priv->chan[i].chgset); +-- +2.40.1 + diff --git a/queue-5.15/i2c-mux-gpio-add-missing-fwnode_handle_put.patch b/queue-5.15/i2c-mux-gpio-add-missing-fwnode_handle_put.patch new file mode 100644 index 00000000000..cde172dc55b --- /dev/null +++ b/queue-5.15/i2c-mux-gpio-add-missing-fwnode_handle_put.patch @@ -0,0 +1,40 @@ +From ad8907cf451424ae047b78cb8a4f471f96e544c1 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 22 Mar 2023 12:29:51 +0800 +Subject: i2c: mux: gpio: Add missing fwnode_handle_put() + +From: Liang He + +[ Upstream commit db6aee6083a56ac4a6cd1b08fff7938072bcd0a3 ] + +In i2c_mux_gpio_probe_fw(), we should add fwnode_handle_put() +when break out of the iteration device_for_each_child_node() +as it will automatically increase and decrease the refcounter. + +Fixes: 98b2b712bc85 ("i2c: i2c-mux-gpio: Enable this driver in ACPI land") +Signed-off-by: Liang He +Signed-off-by: Wolfram Sang +Signed-off-by: Sasha Levin +--- + drivers/i2c/muxes/i2c-mux-gpio.c | 4 +++- + 1 file changed, 3 insertions(+), 1 deletion(-) + +diff --git a/drivers/i2c/muxes/i2c-mux-gpio.c b/drivers/i2c/muxes/i2c-mux-gpio.c +index 31e6eb1591bb9..8bad785dce36f 100644 +--- a/drivers/i2c/muxes/i2c-mux-gpio.c ++++ b/drivers/i2c/muxes/i2c-mux-gpio.c +@@ -103,8 +103,10 @@ static int i2c_mux_gpio_probe_fw(struct gpiomux *mux, + + } else if (is_acpi_node(child)) { + rc = acpi_get_local_address(ACPI_HANDLE_FWNODE(child), values + i); +- if (rc) ++ if (rc) { ++ fwnode_handle_put(child); + return dev_err_probe(dev, rc, "Cannot get address\n"); ++ } + } + + i++; +-- +2.40.1 + diff --git a/queue-5.15/i2c-mux-gpio-replace-custom-acpi_get_local_address.patch b/queue-5.15/i2c-mux-gpio-replace-custom-acpi_get_local_address.patch new file mode 100644 index 00000000000..fa7da09eb74 --- /dev/null +++ b/queue-5.15/i2c-mux-gpio-replace-custom-acpi_get_local_address.patch @@ -0,0 +1,91 @@ +From 47ab08853562de483e26159de199a95513236e9e Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 15 Nov 2021 17:41:59 +0200 +Subject: =?UTF-8?q?i2c:=20mux:=20gpio:=C2=A0Replace=20custom=20acpi=5Fget?= + =?UTF-8?q?=5Flocal=5Faddress()?= +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +From: Andy Shevchenko + +[ Upstream commit 379920f5c013c49e0a740634972faf77e26d4ac3 ] + +Recently ACPI gained the acpi_get_local_address() API which may be used +instead of home grown i2c_mux_gpio_get_acpi_adr(). + +Signed-off-by: Andy Shevchenko +Reviewed-by: Evan Green +Acked-by: Peter Rosin +Signed-off-by: Wolfram Sang +Stable-dep-of: db6aee6083a5 ("i2c: mux: gpio: Add missing fwnode_handle_put()") +Signed-off-by: Sasha Levin +--- + drivers/i2c/muxes/i2c-mux-gpio.c | 43 ++------------------------------ + 1 file changed, 2 insertions(+), 41 deletions(-) + +diff --git a/drivers/i2c/muxes/i2c-mux-gpio.c b/drivers/i2c/muxes/i2c-mux-gpio.c +index bac415a52b780..31e6eb1591bb9 100644 +--- a/drivers/i2c/muxes/i2c-mux-gpio.c ++++ b/drivers/i2c/muxes/i2c-mux-gpio.c +@@ -49,45 +49,6 @@ static int i2c_mux_gpio_deselect(struct i2c_mux_core *muxc, u32 chan) + return 0; + } + +-#ifdef CONFIG_ACPI +- +-static int i2c_mux_gpio_get_acpi_adr(struct device *dev, +- struct fwnode_handle *fwdev, +- unsigned int *adr) +- +-{ +- unsigned long long adr64; +- acpi_status status; +- +- status = acpi_evaluate_integer(ACPI_HANDLE_FWNODE(fwdev), +- METHOD_NAME__ADR, +- NULL, &adr64); +- +- if (!ACPI_SUCCESS(status)) { +- dev_err(dev, "Cannot get address\n"); +- return -EINVAL; +- } +- +- *adr = adr64; +- if (*adr != adr64) { +- dev_err(dev, "Address out of range\n"); +- return -ERANGE; +- } +- +- return 0; +-} +- +-#else +- +-static int i2c_mux_gpio_get_acpi_adr(struct device *dev, +- struct fwnode_handle *fwdev, +- unsigned int *adr) +-{ +- return -EINVAL; +-} +- +-#endif +- + static int i2c_mux_gpio_probe_fw(struct gpiomux *mux, + struct platform_device *pdev) + { +@@ -141,9 +102,9 @@ static int i2c_mux_gpio_probe_fw(struct gpiomux *mux, + fwnode_property_read_u32(child, "reg", values + i); + + } else if (is_acpi_node(child)) { +- rc = i2c_mux_gpio_get_acpi_adr(dev, child, values + i); ++ rc = acpi_get_local_address(ACPI_HANDLE_FWNODE(child), values + i); + if (rc) +- return rc; ++ return dev_err_probe(dev, rc, "Cannot get address\n"); + } + + i++; +-- +2.40.1 + diff --git a/queue-5.15/series b/queue-5.15/series index 8890aa994c4..9e9cd5b6a9b 100644 --- a/queue-5.15/series +++ b/queue-5.15/series @@ -65,3 +65,7 @@ net-ena-flush-xdp-packets-on-error.patch bnxt_en-flush-xdp-for-bnxt_poll_nitroa0-s-napi.patch igc-expose-tx-usecs-coalesce-setting-to-user.patch fix-up-backport-of-136191703038-interconnect-teach-l.patch +gpio-tb10x-fix-an-error-handling-path-in-tb10x_gpio_.patch +i2c-mux-demux-pinctrl-check-the-return-value-of-devm.patch +i2c-mux-gpio-replace-custom-acpi_get_local_address.patch +i2c-mux-gpio-add-missing-fwnode_handle_put.patch