]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
6.6-stable patches
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 14 Oct 2024 06:47:52 +0000 (08:47 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 14 Oct 2024 06:47:52 +0000 (08:47 +0200)
added patches:
hid-amd_sfh-switch-to-device-managed-dmam_alloc_coherent.patch

queue-6.6/hid-amd_sfh-switch-to-device-managed-dmam_alloc_coherent.patch [new file with mode: 0644]
queue-6.6/series

diff --git a/queue-6.6/hid-amd_sfh-switch-to-device-managed-dmam_alloc_coherent.patch b/queue-6.6/hid-amd_sfh-switch-to-device-managed-dmam_alloc_coherent.patch
new file mode 100644 (file)
index 0000000..44ded92
--- /dev/null
@@ -0,0 +1,66 @@
+From c56f9ecb7fb6a3a90079c19eb4c8daf3bbf514b3 Mon Sep 17 00:00:00 2001
+From: Basavaraj Natikar <Basavaraj.Natikar@amd.com>
+Date: Wed, 9 Oct 2024 20:17:57 +0530
+Subject: HID: amd_sfh: Switch to device-managed dmam_alloc_coherent()
+
+From: Basavaraj Natikar <Basavaraj.Natikar@amd.com>
+
+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 <linux-kernel-bugs@hixontech.com>
+Tested-by: Richard <hobbes1069@gmail.com>
+Tested-by: Skyler <skpu@pm.me>
+Reported-by: Chris Hixon <linux-kernel-bugs@hixontech.com>
+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 <Basavaraj.Natikar@amd.com>
+Signed-off-by: Jiri Kosina <jkosina@suse.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ 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
+@@ -236,9 +236,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;
+@@ -331,7 +331,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++) {
+@@ -351,12 +350,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;
+ }
index 48b22eef0e768dc6245ee93c6c3c9bb554f4cb9d..4d1af45e712f60c8c88df09cd2a0e3a6c5b500fa 100644 (file)
@@ -178,3 +178,4 @@ hwmon-tmp513-add-missing-dependency-on-regmap_i2c.patch
 hwmon-mc34vr500-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