Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Skip to content
Commit 9a78d4fc authored by Sowmini Varadhan's avatar Sowmini Varadhan Committed by David S. Miller
Browse files

sparc/pci: Refactor dev_archdata initialization into pci_init_dev_archdata



The function pcibios_add_device() added by commit d0c31e02
("sparc/PCI: Fix for panic while enabling SR-IOV") initializes
the dev_archdata by doing a memcpy from the PF. This has the
problem that it erroneously copies the OF device without
explicitly refcounting it.

As David Miller pointed out: "Generally speaking we don't
really support hot-plug for OF probed devices, but if we did
all of the device tree pointers have to be refcounted properly."

To fix this error, and also avoid code duplication, this patch
creates a new helper function, pci_init_dev_archdata(), that
initializes the fields in dev_archdata, and can be invoked
by callers after they have taken the needed refcounts

Signed-off-by: default avatarSowmini Varadhan <sowmini.varadhan@oracle.com>
Tested-by: default avatarBabu Moger <babu.moger@oracle.com>
Reviewed-by: default avatarKhalid Aziz <khalid.aziz@oracle.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent a95f94bc
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment