Skip to content

Commit

Permalink
s390/zcrypt: remove gratuitious NULL check in .remove() callbacks
Browse files Browse the repository at this point in the history
As .remove() is only called after a successful .probe() call, we can
trust that the drvdata is valid.

Signed-off-by: Julian Wiedmann <[email protected]>
Signed-off-by: Harald Freudenberger <[email protected]>
Signed-off-by: Heiko Carstens <[email protected]>
  • Loading branch information
julianwiedmann authored and hcahca committed Aug 25, 2021
1 parent b5adbbf commit c42257d
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 12 deletions.
6 changes: 2 additions & 4 deletions drivers/s390/crypto/zcrypt_cex2a.c
Original file line number Diff line number Diff line change
Expand Up @@ -132,8 +132,7 @@ static void zcrypt_cex2a_card_remove(struct ap_device *ap_dev)
{
struct zcrypt_card *zc = dev_get_drvdata(&ap_dev->device);

if (zc)
zcrypt_card_unregister(zc);
zcrypt_card_unregister(zc);
}

static struct ap_driver zcrypt_cex2a_card_driver = {
Expand Down Expand Up @@ -192,8 +191,7 @@ static void zcrypt_cex2a_queue_remove(struct ap_device *ap_dev)
{
struct zcrypt_queue *zq = dev_get_drvdata(&ap_dev->device);

if (zq)
zcrypt_queue_unregister(zq);
zcrypt_queue_unregister(zq);
}

static struct ap_driver zcrypt_cex2a_queue_driver = {
Expand Down
8 changes: 4 additions & 4 deletions drivers/s390/crypto/zcrypt_cex2c.c
Original file line number Diff line number Diff line change
Expand Up @@ -314,8 +314,8 @@ static void zcrypt_cex2c_card_remove(struct ap_device *ap_dev)

if (ap_test_bit(&ac->functions, AP_FUNC_COPRO))
sysfs_remove_group(&ap_dev->device.kobj, &cca_card_attr_grp);
if (zc)
zcrypt_card_unregister(zc);

zcrypt_card_unregister(zc);
}

static struct ap_driver zcrypt_cex2c_card_driver = {
Expand Down Expand Up @@ -387,8 +387,8 @@ static void zcrypt_cex2c_queue_remove(struct ap_device *ap_dev)

if (ap_test_bit(&aq->card->functions, AP_FUNC_COPRO))
sysfs_remove_group(&ap_dev->device.kobj, &cca_queue_attr_grp);
if (zq)
zcrypt_queue_unregister(zq);

zcrypt_queue_unregister(zq);
}

static struct ap_driver zcrypt_cex2c_queue_driver = {
Expand Down
8 changes: 4 additions & 4 deletions drivers/s390/crypto/zcrypt_cex4.c
Original file line number Diff line number Diff line change
Expand Up @@ -575,8 +575,8 @@ static void zcrypt_cex4_card_remove(struct ap_device *ap_dev)
sysfs_remove_group(&ap_dev->device.kobj, &cca_card_attr_grp);
else if (ap_test_bit(&ac->functions, AP_FUNC_EP11))
sysfs_remove_group(&ap_dev->device.kobj, &ep11_card_attr_grp);
if (zc)
zcrypt_card_unregister(zc);

zcrypt_card_unregister(zc);
}

static struct ap_driver zcrypt_cex4_card_driver = {
Expand Down Expand Up @@ -665,8 +665,8 @@ static void zcrypt_cex4_queue_remove(struct ap_device *ap_dev)
sysfs_remove_group(&ap_dev->device.kobj, &cca_queue_attr_grp);
else if (ap_test_bit(&aq->card->functions, AP_FUNC_EP11))
sysfs_remove_group(&ap_dev->device.kobj, &ep11_queue_attr_grp);
if (zq)
zcrypt_queue_unregister(zq);

zcrypt_queue_unregister(zq);
}

static struct ap_driver zcrypt_cex4_queue_driver = {
Expand Down

0 comments on commit c42257d

Please sign in to comment.