From: Greg Kroah-Hartman Date: Mon, 14 Oct 2024 06:47:19 +0000 (+0200) Subject: 5.15-stable patches X-Git-Tag: v5.10.227~55 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=78cc2843cefe69807148e2ff65ff18fa29323e31;p=thirdparty%2Fkernel%2Fstable-queue.git 5.15-stable patches added patches: hid-amd_sfh-switch-to-device-managed-dmam_alloc_coherent.patch --- diff --git a/queue-5.15/hid-amd_sfh-switch-to-device-managed-dmam_alloc_coherent.patch b/queue-5.15/hid-amd_sfh-switch-to-device-managed-dmam_alloc_coherent.patch new file mode 100644 index 00000000000..7e8b7ec2903 --- /dev/null +++ b/queue-5.15/hid-amd_sfh-switch-to-device-managed-dmam_alloc_coherent.patch @@ -0,0 +1,66 @@ +From c56f9ecb7fb6a3a90079c19eb4c8daf3bbf514b3 Mon Sep 17 00:00:00 2001 +From: Basavaraj Natikar +Date: Wed, 9 Oct 2024 20:17:57 +0530 +Subject: HID: amd_sfh: Switch to device-managed dmam_alloc_coherent() + +From: Basavaraj Natikar + +commit c56f9ecb7fb6a3a90079c19eb4c8daf3bbf514b3 upstream. + +Using the device-managed version allows to simplify clean-up in probe() +error path. + +Additionally, this device-managed ensures proper cleanup, which helps to +resolve memory errors, page faults, btrfs going read-only, and btrfs +disk corruption. + +Fixes: 4b2c53d93a4b ("SFH:Transport Driver to add support of AMD Sensor Fusion Hub (SFH)") +Tested-by: Chris Hixon +Tested-by: Richard +Tested-by: Skyler +Reported-by: Chris Hixon +Closes: https://lore.kernel.org/all/3b129b1f-8636-456a-80b4-0f6cce0eef63@hixontech.com/ +Link: https://bugzilla.kernel.org/show_bug.cgi?id=219331 +Signed-off-by: Basavaraj Natikar +Signed-off-by: Jiri Kosina +Signed-off-by: Greg Kroah-Hartman +--- + drivers/hid/amd-sfh-hid/amd_sfh_client.c | 14 +++----------- + 1 file changed, 3 insertions(+), 11 deletions(-) + +--- a/drivers/hid/amd-sfh-hid/amd_sfh_client.c ++++ b/drivers/hid/amd-sfh-hid/amd_sfh_client.c +@@ -163,9 +163,9 @@ int amd_sfh_hid_client_init(struct amd_m + cl_data->in_data = in_data; + + for (i = 0; i < cl_data->num_hid_devices; i++) { +- in_data->sensor_virt_addr[i] = dma_alloc_coherent(dev, sizeof(int) * 8, +- &cl_data->sensor_dma_addr[i], +- GFP_KERNEL); ++ in_data->sensor_virt_addr[i] = dmam_alloc_coherent(dev, sizeof(int) * 8, ++ &cl_data->sensor_dma_addr[i], ++ GFP_KERNEL); + if (!in_data->sensor_virt_addr[i]) { + rc = -ENOMEM; + goto cleanup; +@@ -263,7 +263,6 @@ cleanup: + int amd_sfh_hid_client_deinit(struct amd_mp2_dev *privdata) + { + struct amdtp_cl_data *cl_data = privdata->cl_data; +- struct amd_input_data *in_data = cl_data->in_data; + int i, status; + + for (i = 0; i < cl_data->num_hid_devices; i++) { +@@ -282,12 +281,5 @@ int amd_sfh_hid_client_deinit(struct amd + cancel_delayed_work_sync(&cl_data->work_buffer); + amdtp_hid_remove(cl_data); + +- for (i = 0; i < cl_data->num_hid_devices; i++) { +- if (in_data->sensor_virt_addr[i]) { +- dma_free_coherent(&privdata->pdev->dev, 8 * sizeof(int), +- in_data->sensor_virt_addr[i], +- cl_data->sensor_dma_addr[i]); +- } +- } + return 0; + } diff --git a/queue-5.15/series b/queue-5.15/series index f70b8d19238..60552033768 100644 --- a/queue-5.15/series +++ b/queue-5.15/series @@ -668,3 +668,4 @@ x86-fpu-avoid-writing-lbr-bit-to-ia32_xss-unless-sup.patch hwmon-tmp513-add-missing-dependency-on-regmap_i2c.patch hwmon-adm9240-add-missing-dependency-on-regmap_i2c.patch hwmon-adt7470-add-missing-dependency-on-regmap_i2c.patch +hid-amd_sfh-switch-to-device-managed-dmam_alloc_coherent.patch