Commit 3d0cfea2 authored by David E. Box's avatar David E. Box Committed by Jia, Yingbao
Browse files

platform/x86/intel/vsec: Assign auxdev parent by argument

mainline inclusion
from mainline-v6.8
commit 6dfc2514acee37e30ce59f1f25b1f8f6aa7c1b08
category: bugfix
bugzilla: https://gitee.com/openeuler/intel-kernel/issues/IB6QCG
CVE: NA
Reference: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=6dfc2514acee37e30ce59f1f25b1f8f6aa7c1b08



-------------------------------------------------

Intel-SIG: commit 6dfc2514acee platform/x86/intel/vsec: Assign auxdev parent by argument.
Backport intel tpmi base driver update for 5.10

Instead of checking for a NULL parent argument in intel_vsec_add_aux() and
then assigning it to the probed device, remove this check and just pass the
device in the call. Since this function is exported, return -EINVAL if the
parent is not specified.

Signed-off-by: default avatarDavid E. Box <david.e.box@linux.intel.com>
Reviewed-by: default avatarIlpo Järvinen <ilpo.jarvinen@linux.intel.com>
Link: https://lore.kernel.org/r/20231129222132.2331261-7-david.e.box@linux.intel.com


Signed-off-by: default avatarHans de Goede <hdegoede@redhat.com>
[ Yingbao Jia: amend commit log ]
Signed-off-by: default avatarYingbao Jia <yingbao.jia@intel.com>
parent f46f3818
Loading
Loading
Loading
Loading
+4 −4
Original line number Diff line number Diff line
@@ -95,6 +95,9 @@ int intel_vsec_add_aux(struct pci_dev *pdev, struct device *parent,
	struct auxiliary_device *auxdev = &intel_vsec_dev->auxdev;
	int ret, id;

	if (!parent)
		return -EINVAL;

	ret = xa_alloc(&auxdev_array, &intel_vsec_dev->id, intel_vsec_dev,
		       PMT_XA_LIMIT, GFP_KERNEL);
	if (ret < 0) {
@@ -113,9 +116,6 @@ int intel_vsec_add_aux(struct pci_dev *pdev, struct device *parent,
		return id;
	}

	if (!parent)
		parent = &pdev->dev;

	auxdev->id = id;
	auxdev->name = name;
	auxdev->dev.parent = parent;
@@ -190,7 +190,7 @@ static int intel_vsec_add_dev(struct pci_dev *pdev, struct intel_vsec_header *he
	intel_vsec_dev->quirks = info->quirks;
	intel_vsec_dev->ida = &intel_vsec_ida;

	return intel_vsec_add_aux(pdev, NULL, intel_vsec_dev,
	return intel_vsec_add_aux(pdev, &pdev->dev, intel_vsec_dev,
				  intel_vsec_name(header->id));
}