s390/pci: fix misleading rc in clp_set_pci_fn()
authorNiklas Schnelle <schnelle@linux.ibm.com>
Wed, 21 Jul 2021 17:58:54 +0000 (19:58 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 15 Sep 2021 07:50:27 +0000 (09:50 +0200)
commit0404bf4a660ca8d5c82b8252f55f1f64506aa09a
treeb57b86e89a6d32f0418136a74aa00007da6e0f59
parent8b471e72b51e4d2617f27215da3f7840090fb22b
s390/pci: fix misleading rc in clp_set_pci_fn()

[ Upstream commit f7addcdd527a6dddfebe20c358b87bdb95624612 ]

Currently clp_set_pci_fn() always returns 0 as long as the CLP request
itself succeeds even if the operation itself returns a response code
other than CLP_RC_OK or CLP_RC_SETPCIFN_ALRDY. This is highly misleading
because calling code assumes that a zero rc means that the operation was
successful.

Fix this by returning the response code or cc on failure with the
exception of the special handling for CLP_RC_SETPCIFN_ALRDY. Also let's
not assume that the returned function handle for CLP_RC_SETPCIFN_ALRDY
is 0, we don't need it anyway.

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>
Signed-off-by: Sasha Levin <sashal@kernel.org>
arch/s390/pci/pci.c
arch/s390/pci/pci_clp.c