Skip to content

Commit 6dfc251

Browse files
debox1jwrdegoede
authored andcommitted
platform/x86/intel/vsec: Assign auxdev parent by argument
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: David E. Box <david.e.box@linux.intel.com> Reviewed-by: Ilpo 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: Hans de Goede <hdegoede@redhat.com>
1 parent 1d1b477 commit 6dfc251

File tree

1 file changed

+4
-4
lines changed
  • drivers/platform/x86/intel

1 file changed

+4
-4
lines changed

drivers/platform/x86/intel/vsec.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,9 @@ int intel_vsec_add_aux(struct pci_dev *pdev, struct device *parent,
103103
struct auxiliary_device *auxdev = &intel_vsec_dev->auxdev;
104104
int ret, id;
105105

106+
if (!parent)
107+
return -EINVAL;
108+
106109
ret = xa_alloc(&auxdev_array, &intel_vsec_dev->id, intel_vsec_dev,
107110
PMT_XA_LIMIT, GFP_KERNEL);
108111
if (ret < 0) {
@@ -121,9 +124,6 @@ int intel_vsec_add_aux(struct pci_dev *pdev, struct device *parent,
121124
return id;
122125
}
123126

124-
if (!parent)
125-
parent = &pdev->dev;
126-
127127
auxdev->id = id;
128128
auxdev->name = name;
129129
auxdev->dev.parent = parent;
@@ -205,7 +205,7 @@ static int intel_vsec_add_dev(struct pci_dev *pdev, struct intel_vsec_header *he
205205
* Pass the ownership of intel_vsec_dev and resource within it to
206206
* intel_vsec_add_aux()
207207
*/
208-
return intel_vsec_add_aux(pdev, NULL, no_free_ptr(intel_vsec_dev),
208+
return intel_vsec_add_aux(pdev, &pdev->dev, no_free_ptr(intel_vsec_dev),
209209
intel_vsec_name(header->id));
210210
}
211211

0 commit comments

Comments
 (0)