Skip to content

Commit ebd9cc6

Browse files
niklas88hcahca
authored andcommitted
s390/pci: fix clp_get_state() handling of -ENODEV
With commit cc049ee ("s390/pci: simplify CLP List PCI handling") clp_get_state() was changed to make use of the new clp_find_pci() helper function to query a specific function. This however returns -ENODEV when the device is not found at all and this error was passed to the caller. It was missed however that the callers actually expect a success return from clp_get_state() if the device is gone. Fix this by handling the -ENODEV return of clp_find_pci() explicitly in clp_get_state() returning success and setting the state parameter to ZPCI_FN_STATE_RESERVED matching the design concept that a PCI function that disappeared must have been resverved elsewhere. For all other error returns continue to just pass them on to the caller. Reviewed-by: Matthew Rosato <[email protected]> Fixes: cc049ee ("s390/pci: simplify CLP List PCI handling") Signed-off-by: Niklas Schnelle <[email protected]> Signed-off-by: Heiko Carstens <[email protected]>
1 parent 19379d4 commit ebd9cc6

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

arch/s390/pci/pci_clp.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -449,14 +449,17 @@ int clp_get_state(u32 fid, enum zpci_state *state)
449449
struct clp_fh_list_entry entry;
450450
int rc;
451451

452-
*state = ZPCI_FN_STATE_RESERVED;
453452
rrb = clp_alloc_block(GFP_ATOMIC);
454453
if (!rrb)
455454
return -ENOMEM;
456455

457456
rc = clp_find_pci(rrb, fid, &entry);
458-
if (!rc)
457+
if (!rc) {
459458
*state = entry.config_state;
459+
} else if (rc == -ENODEV) {
460+
*state = ZPCI_FN_STATE_RESERVED;
461+
rc = 0;
462+
}
460463

461464
clp_free_block(rrb);
462465
return rc;

0 commit comments

Comments
 (0)