Fixes and updates to amd-sfh driver
Subsystems (2)
Basavaraj Natikar
maintainercover Fixes and updates to amd-sfh driver
Changes include fix to NULL pointer dereference, remove pci_ wrappers, use dma_set_mask_and_coherent and copyright updates.
Basavaraj Natikar (4):
amd_sfh: Fix potential NULL pointer dereference
amd_sfh: Use dma_set_mask_and_coherent()
amd_sfh: switch from 'pci_' to 'dev_' API
amd_sfh: Update Copyright details
drivers/hid/amd-sfh-hid/amd_sfh_client.c | 3 +- drivers/hid/amd-sfh-hid/amd_sfh_hid.c | 2 ++ drivers/hid/amd-sfh-hid/amd_sfh_hid.h | 2 ++ drivers/hid/amd-sfh-hid/amd_sfh_pcie.c | 33 +++++++++---------- drivers/hid/amd-sfh-hid/amd_sfh_pcie.h | 3 +- .../hid_descriptor/amd_sfh_hid_desc.c | 3 +- .../hid_descriptor/amd_sfh_hid_desc.h | 3 +- .../hid_descriptor/amd_sfh_hid_report_desc.h | 3 +- 8 files changed, 30 insertions(+), 22 deletions(-)
Signature · 1 line
2.25.1
Basavaraj Natikar
maintainerPATCH 1/4 amd_sfh: Fix potential NULL pointer dereference
The cl_data field of a privdata must be allocated and updated before using in amd_sfh_hid_client_init() function.
Hence handling NULL pointer cl_data accordingly.
--- drivers/hid/amd-sfh-hid/amd_sfh_pcie.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-)
drivers/hid/amd-sfh-hid/amd_sfh_pcie.c +4 -8
@@ -251,21 +251,17 @@ static int amd_mp2_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ireturn rc; } - rc =amd_sfh_hid_client_init (privdata); -if (rc) -return rc; - privdata->cl_data =devm_kzalloc (&pdev->dev,sizeof (struct amdtp_cl_data ),GFP_KERNEL );if (!privdata->cl_data)return -ENOMEM ; - rc =devm_add_action_or_reset (&pdev->dev, amd_mp2_pci_remove, privdata); +mp2_select_ops (privdata); + + rc =amd_sfh_hid_client_init (privdata);if (rc)return rc; -mp2_select_ops (privdata); - -return 0 ; +return devm_add_action_or_reset (&pdev->dev, amd_mp2_pci_remove, privdata); }static int __maybe_unused amd_mp2_pci_resume (struct device *dev)
Signature · 1 line
2.25.1
Basavaraj Natikar
maintainerPATCH 2/4 amd_sfh: Use dma_set_mask_and_coherent()
In reply to Basavaraj NatikarUse dma_set_mask_and_coherent() to set both the streaming and coherent masks.
--- drivers/hid/amd-sfh-hid/amd_sfh_pcie.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-)
drivers/hid/amd-sfh-hid/amd_sfh_pcie.c +6 -3
@@ -245,10 +245,13 @@ static int amd_mp2_pci_probe(struct pci_dev *pdev, const struct pci_device_id *i privdata->mmio =pcim_iomap_table (pdev)[2 ];pci_set_master (pdev); - rc =dma_set_mask (&pdev->dev,DMA_BIT_MASK (64 )); + rc =dma_set_mask_and_coherent (&pdev->dev,DMA_BIT_MASK (64 ));if (rc) { - rc =dma_set_mask (&pdev->dev,DMA_BIT_MASK (32 )); -return rc; + rc =dma_set_mask_and_coherent (&pdev->dev,DMA_BIT_MASK (32 )); +if (rc) { +dev_err (&pdev->dev,"failed to set DMA mask\n" ); +return rc; + } } privdata->cl_data =devm_kzalloc (&pdev->dev,sizeof (struct amdtp_cl_data ),GFP_KERNEL );
Signature · 1 line
2.25.1
Basavaraj Natikar
maintainerPATCH 3/4 amd_sfh: switch from 'pci_' to 'dev_' API
In reply to Basavaraj NatikarThe wrappers pci_set_drvdata or pci_get_drvdata changed to dev_set_drvdata or dev_get_drvdata.
--- drivers/hid/amd-sfh-hid/amd_sfh_pcie.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-)
drivers/hid/amd-sfh-hid/amd_sfh_pcie.c +3 -5
@@ -234,7 +234,7 @@ static int amd_mp2_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ireturn -ENOMEM ; privdata->pdev = pdev; -pci_set_drvdata (pdev, privdata); +dev_set_drvdata (&pdev->dev, privdata); rc =pcim_enable_device (pdev);if (rc)return rc;
@@ -269,8 +269,7 @@ static int amd_mp2_pci_probe(struct pci_dev *pdev, const struct pci_device_id *istatic int __maybe_unused amd_mp2_pci_resume (struct device *dev) { -struct pci_dev *pdev =to_pci_dev (dev); -struct amd_mp2_dev *mp2 =pci_get_drvdata (pdev); +struct amd_mp2_dev *mp2 =dev_get_drvdata (dev);struct amdtp_cl_data *cl_data = mp2->cl_data;struct amd_mp2_sensor_info info;int i, status;
@@ -295,8 +294,7 @@ static int __maybe_unused amd_mp2_pci_resume(struct device *dev)static int __maybe_unused amd_mp2_pci_suspend (struct device *dev) { -struct pci_dev *pdev =to_pci_dev (dev); -struct amd_mp2_dev *mp2 =pci_get_drvdata (pdev); +struct amd_mp2_dev *mp2 =dev_get_drvdata (dev);struct amdtp_cl_data *cl_data = mp2->cl_data;int i, status;
Signature · 1 line
2.25.1
Basavaraj Natikar
maintainerPATCH 4/4 amd_sfh: Update Copyright details
In reply to Basavaraj NatikarUpdate the Copyright header and Author
--- drivers/hid/amd-sfh-hid/amd_sfh_client.c | 3 ++- drivers/hid/amd-sfh-hid/amd_sfh_hid.c | 2 ++ drivers/hid/amd-sfh-hid/amd_sfh_hid.h | 2 ++ drivers/hid/amd-sfh-hid/amd_sfh_pcie.c | 4 +++- drivers/hid/amd-sfh-hid/amd_sfh_pcie.h | 3 ++- drivers/hid/amd-sfh-hid/hid_descriptor/amd_sfh_hid_desc.c | 3 ++- drivers/hid/amd-sfh-hid/hid_descriptor/amd_sfh_hid_desc.h | 3 ++- .../hid/amd-sfh-hid/hid_descriptor/amd_sfh_hid_report_desc.h | 3 ++- 8 files changed, 17 insertions(+), 6 deletions(-)
drivers/hid/amd-sfh-hid/amd_sfh_client.c +2 -1
@@ -1,9 +1,10 @@// SPDX-License-Identifier: GPL-2.0-or-later /* * AMD SFH Client Layer -* Copyright 2020 Advanced Micro Devices, Inc. +* Copyright 2020-2021 Advanced Micro Devices, Inc. * Authors: Nehal Bakulchandra Shah <[email protected]> * Sandeep Singh <[email protected]> +* Basavaraj Natikar <[email protected]> */ #include <linux/dma-mapping.h>
drivers/hid/amd-sfh-hid/amd_sfh_hid.c +2 -0
@@ -2,8 +2,10 @@/* * AMD MP2 Sensors transport driver * +* Copyright 2020-2021 Advanced Micro Devices, Inc. * Authors: Nehal Bakulchandra Shah <[email protected]> * Sandeep Singh <[email protected]> +* Basavaraj Natikar <[email protected]> */ #include <linux/hid.h> #include <linux/wait.h>
drivers/hid/amd-sfh-hid/amd_sfh_hid.h +2 -0
@@ -2,8 +2,10 @@/* * AMD MP2 Sensors transport driver * +* Copyright 2020-2021 Advanced Micro Devices, Inc. * Authors: Nehal Bakulchandra Shah <[email protected]> * Sandeep Singh <[email protected]> +* Basavaraj Natikar <[email protected]> */ #ifndef AMDSFH_HID_H
drivers/hid/amd-sfh-hid/amd_sfh_pcie.c +3 -1
@@ -1,10 +1,11 @@// SPDX-License-Identifier: GPL-2.0-or-later /* * AMD MP2 PCIe communication driver -* Copyright 2020 Advanced Micro Devices, Inc. +* Copyright 2020-2021 Advanced Micro Devices, Inc. * * Authors: Shyam Sundar S K <[email protected]> * Sandeep Singh <[email protected]> +* Basavaraj Natikar <[email protected]> */ #include <linux/bitops.h>
@@ -335,3 +336,4 @@ MODULE_DESCRIPTION(DRIVER_DESC);MODULE_LICENSE ("Dual BSD/GPL" );MODULE_AUTHOR ("Shyam Sundar S K <[email protected]>" );MODULE_AUTHOR ("Sandeep Singh <[email protected]>" ); +MODULE_AUTHOR ("Basavaraj Natikar <[email protected]>" );
drivers/hid/amd-sfh-hid/amd_sfh_pcie.h +2 -1
@@ -1,9 +1,10 @@/* SPDX-License-Identifier: GPL-2.0-or-later */ /* * AMD MP2 PCIe communication driver -* Copyright 2020 Advanced Micro Devices, Inc. +* Copyright 2020-2021 Advanced Micro Devices, Inc. * Authors: Shyam Sundar S K <[email protected]> * Sandeep Singh <[email protected]> +* Basavaraj Natikar <[email protected]> */ #ifndef PCIE_MP2_AMD_H
drivers/hid/amd-sfh-hid/hid_descriptor/amd_sfh_hid_desc.c +2 -1
@@ -1,9 +1,10 @@// SPDX-License-Identifier: GPL-2.0-or-later /* * AMD SFH Report Descriptor generator -* Copyright 2020 Advanced Micro Devices, Inc. +* Copyright 2020-2021 Advanced Micro Devices, Inc. * Authors: Nehal Bakulchandra Shah <[email protected]> * Sandeep Singh <[email protected]> +* Basavaraj Natikar <[email protected]> */ #include <linux/kernel.h>
drivers/hid/amd-sfh-hid/hid_descriptor/amd_sfh_hid_desc.h +2 -1
@@ -1,9 +1,10 @@/* SPDX-License-Identifier: GPL-2.0-or-later */ /* * HID report descriptors, structures and routines -* Copyright 2020 Advanced Micro Devices, Inc. +* Copyright 2020-2021 Advanced Micro Devices, Inc. * Authors: Nehal Bakulchandra Shah <[email protected]> * Sandeep Singh <[email protected]> +* Basavaraj Natikar <[email protected]> */ #ifndef AMD_SFH_HID_DESCRIPTOR_H
drivers/hid/amd-sfh-hid/hid_descriptor/amd_sfh_hid_report_desc.h +2 -1
@@ -1,9 +1,10 @@/* SPDX-License-Identifier: GPL-2.0-or-later */ /* * HID descriptor stuructures -* Copyright 2020 Advanced Micro Devices, Inc. +* Copyright 2020-2021 Advanced Micro Devices, Inc. * Authors: Nehal Bakulchandra Shah <[email protected]> * Sandeep Singh <[email protected]> +* Basavaraj Natikar <[email protected]> */ #ifndef AMD_SFH_HID_REPORT_DESCRIPTOR_H
Signature · 1 line
2.25.1
Jiri Kosina
maintainerQuoted 6 lines · Basavaraj Natikar
Changes include fix to NULL pointer dereference, remove
pci_wrappers, usedma_set_mask_and_coherentand copyright updates.Basavaraj Natikar (4):
amd_sfh: Fix potential NULL pointer dereference
amd_sfh: Usedma_set_mask_and_coherent()
Thanks for the patches. My plan is to push the two above as 5.15 material (fixes), and queue the 2 below as 5.16 merge window material. Please holler if you disagree.
Quoted 2 lines
amd_sfh: switch from 'pci_' to 'dev_' API
amd_sfh: Update Copyright details
Signature · 2 lines
Jiri Kosina SUSE Labs
Quoted 7 lines · Jiri Kosina
[CAUTION: External Email]
Quoted 3 lines · Basavaraj Natikar
Changes include fix to NULL pointer dereference, remove
pci_wrappers, usedma_set_mask_and_coherentand copyright updates.
Quoted 9 lines
Quoted 3 lines
Basavaraj Natikar (4):
amd_sfh: Fix potential NULL pointer dereference
amd_sfh: Usedma_set_mask_and_coherent()Thanks for the patches. My plan is to push the two above as 5.15 material (fixes), and queue the 2 below as 5.16 merge window material. Please holler if you disagree.
Quoted 2 lines
amd_sfh: switch from 'pci_' to 'dev_' API
amd_sfh: Update Copyright details
Makes sense. Appreciate your help.
Thanks,
Basavaraj