Reject a NULL pci_ops argument in tsm_register(). Every registered TSM then has PCI operations, so registration no longer needs separate paths for TSMs without them. Cc: Alexey Kardashevskiy Cc: Jason Gunthorpe Cc: Lukas Wunner Cc: linux-coco@lists.linux.dev Signed-off-by: Aneesh Kumar K.V (Arm) --- drivers/virt/coco/tsm-core.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/virt/coco/tsm-core.c b/drivers/virt/coco/tsm-core.c index e784993353d8..03894c5663f1 100644 --- a/drivers/virt/coco/tsm-core.c +++ b/drivers/virt/coco/tsm-core.c @@ -61,9 +61,6 @@ static struct tsm_dev *tsm_register_pci_or_reset(struct tsm_dev *tsm_dev, { int rc; - if (!pci_ops) - return tsm_dev; - tsm_dev->pci_ops = pci_ops; rc = pci_tsm_register(tsm_dev); if (rc) { @@ -84,6 +81,9 @@ struct tsm_dev *tsm_register(struct device *parent, struct pci_tsm_ops *pci_ops) struct device *dev; int rc; + if (!pci_ops) + return ERR_PTR(-EINVAL); + if (IS_ERR(tsm_dev)) return tsm_dev; -- 2.43.0