Skip to content

Commit 0e72b78

Browse files
hfreudeVasily Gorbik
authored andcommitted
s390/zcrypt: Explicitly use a card variable in _zcrypt_send_cprb
Use an explicit variable "card" for the card addressing in function _zcrypt_send_cprb instead of the confusing field "user_defined" from the ica_xcRB struct. This makes the code somewhat cleaner and easier to understand. Reviewed-by: Holger Dengler <dengler@linux.ibm.com> Signed-off-by: Harald Freudenberger <freude@linux.ibm.com> Acked-by: Heiko Carstens <hca@linux.ibm.com> Signed-off-by: Vasily Gorbik <gor@linux.ibm.com>
1 parent 227a919 commit 0e72b78

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

drivers/s390/crypto/zcrypt_api.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -854,7 +854,7 @@ static long _zcrypt_send_cprb(u32 xflags, struct ap_perms *perms,
854854
struct ica_xcRB *xcrb)
855855
{
856856
bool userspace = xflags & ZCRYPT_XFLAG_USERSPACE;
857-
unsigned int domain, func_code = 0;
857+
unsigned int card, domain, func_code = 0;
858858
unsigned int wgt = 0, pref_wgt = 0;
859859
struct zcrypt_queue *zq, *pref_zq;
860860
struct zcrypt_card *zc, *pref_zc;
@@ -899,15 +899,15 @@ static long _zcrypt_send_cprb(u32 xflags, struct ap_perms *perms,
899899

900900
pref_zc = NULL;
901901
pref_zq = NULL;
902+
card = xcrb->user_defined;
902903
spin_lock(&zcrypt_list_lock);
903904
for_each_zcrypt_card(zc) {
904905
/* Check for usable CCA card */
905906
if (!zc->online || !zc->card->config || zc->card->chkstop ||
906907
!zc->card->hwinfo.cca)
907908
continue;
908909
/* Check for user selected CCA card */
909-
if (xcrb->user_defined != AUTOSELECT &&
910-
xcrb->user_defined != zc->card->id)
910+
if (card != AUTOSELECT && card != zc->card->id)
911911
continue;
912912
/* check if request size exceeds card max msg size */
913913
if (ap_msg.len > zc->card->maxmsgsize)
@@ -951,7 +951,7 @@ static long _zcrypt_send_cprb(u32 xflags, struct ap_perms *perms,
951951

952952
if (!pref_zq) {
953953
pr_debug("no match for address %02x.%04x => ENODEV\n",
954-
xcrb->user_defined, domain);
954+
card, domain);
955955
rc = -ENODEV;
956956
goto out;
957957
}

0 commit comments

Comments
 (0)