mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2025-01-11 15:40:50 +00:00
s390/pci: reset zdev->zbus on registration failure
On failure to register a struct zpci_dev with a struct zpci_bus we left a dangling pointer in zdev->zbus. As zpci_create_device() bails if zpci_bus_device_register() fails this is of no consequence but still bad practice. Reviewed-by: Matthew Rosato <mjrosato@linux.ibm.com> Signed-off-by: Niklas Schnelle <schnelle@linux.ibm.com> Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
This commit is contained in:
parent
02368b7cf6
commit
81a076171e
@ -343,11 +343,11 @@ static int zpci_bus_add_device(struct zpci_bus *zbus, struct zpci_dev *zdev)
|
|||||||
{
|
{
|
||||||
int rc = -EINVAL;
|
int rc = -EINVAL;
|
||||||
|
|
||||||
zdev->zbus = zbus;
|
|
||||||
if (zbus->function[zdev->devfn]) {
|
if (zbus->function[zdev->devfn]) {
|
||||||
pr_err("devfn %04x is already assigned\n", zdev->devfn);
|
pr_err("devfn %04x is already assigned\n", zdev->devfn);
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
zdev->zbus = zbus;
|
||||||
zbus->function[zdev->devfn] = zdev;
|
zbus->function[zdev->devfn] = zdev;
|
||||||
zpci_nb_devices++;
|
zpci_nb_devices++;
|
||||||
|
|
||||||
@ -367,6 +367,7 @@ static int zpci_bus_add_device(struct zpci_bus *zbus, struct zpci_dev *zdev)
|
|||||||
|
|
||||||
error:
|
error:
|
||||||
zbus->function[zdev->devfn] = NULL;
|
zbus->function[zdev->devfn] = NULL;
|
||||||
|
zdev->zbus = NULL;
|
||||||
zpci_nb_devices--;
|
zpci_nb_devices--;
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user