The driver data will be cleared in device_unbind_cleanup() in driver core code. So the dev_set_drvdata(..., NULL) called in remove and error path in probe can be removed. Signed-off-by: Yang Yingliang <yangyingliang@xxxxxxxxxx> --- drivers/s390/block/scm_drv.c | 2 -- drivers/s390/char/con3215.c | 1 - drivers/s390/char/tape_core.c | 1 - drivers/s390/cio/chsc_sch.c | 2 -- drivers/s390/cio/vfio_ccw_drv.c | 2 -- drivers/s390/crypto/vfio_ap_ops.c | 1 - 6 files changed, 9 deletions(-) diff --git a/drivers/s390/block/scm_drv.c b/drivers/s390/block/scm_drv.c index 69a845eb8b1f..8106190032c1 100644 --- a/drivers/s390/block/scm_drv.c +++ b/drivers/s390/block/scm_drv.c @@ -51,7 +51,6 @@ static int scm_probe(struct scm_device *scmdev) dev_set_drvdata(&scmdev->dev, bdev); ret = scm_blk_dev_setup(bdev, scmdev); if (ret) { - dev_set_drvdata(&scmdev->dev, NULL); kfree(bdev); goto out; } @@ -65,7 +64,6 @@ static void scm_remove(struct scm_device *scmdev) struct scm_blk_dev *bdev = dev_get_drvdata(&scmdev->dev); scm_blk_dev_cleanup(bdev); - dev_set_drvdata(&scmdev->dev, NULL); kfree(bdev); } diff --git a/drivers/s390/char/con3215.c b/drivers/s390/char/con3215.c index a1fef666c9b0..b0ecc32c8241 100644 --- a/drivers/s390/char/con3215.c +++ b/drivers/s390/char/con3215.c @@ -743,7 +743,6 @@ static void raw3215_remove(struct ccw_device *cdev) break; raw3215[line] = NULL; spin_unlock(&raw3215_device_lock); - dev_set_drvdata(&cdev->dev, NULL); raw3215_free_info(raw); } } diff --git a/drivers/s390/char/tape_core.c b/drivers/s390/char/tape_core.c index a6d2a4792185..7a6e1804cf8f 100644 --- a/drivers/s390/char/tape_core.c +++ b/drivers/s390/char/tape_core.c @@ -662,7 +662,6 @@ tape_generic_remove(struct ccw_device *cdev) device = dev_get_drvdata(&cdev->dev); if (device) { sysfs_remove_group(&cdev->dev.kobj, &tape_attr_group); - dev_set_drvdata(&cdev->dev, NULL); tape_put_device(device); } } diff --git a/drivers/s390/cio/chsc_sch.c b/drivers/s390/cio/chsc_sch.c index 180ab899289c..15ac2b489a00 100644 --- a/drivers/s390/cio/chsc_sch.c +++ b/drivers/s390/cio/chsc_sch.c @@ -90,7 +90,6 @@ static int chsc_subchannel_probe(struct subchannel *sch) if (ret) { CHSC_MSG(0, "Failed to enable 0.%x.%04x: %d\n", sch->schid.ssid, sch->schid.sch_no, ret); - dev_set_drvdata(&sch->dev, NULL); kfree(private); } return ret; @@ -102,7 +101,6 @@ static void chsc_subchannel_remove(struct subchannel *sch) cio_disable_subchannel(sch); private = dev_get_drvdata(&sch->dev); - dev_set_drvdata(&sch->dev, NULL); if (private->request) { complete(&private->request->completion); put_device(&sch->dev); diff --git a/drivers/s390/cio/vfio_ccw_drv.c b/drivers/s390/cio/vfio_ccw_drv.c index 43601816ea4e..ee05825518c2 100644 --- a/drivers/s390/cio/vfio_ccw_drv.c +++ b/drivers/s390/cio/vfio_ccw_drv.c @@ -202,7 +202,6 @@ static int vfio_ccw_sch_probe(struct subchannel *sch) device_del(&parent->dev); out_free: put_device(&parent->dev); - dev_set_drvdata(&sch->dev, NULL); return ret; } @@ -213,7 +212,6 @@ static void vfio_ccw_sch_remove(struct subchannel *sch) mdev_unregister_parent(&parent->parent); device_unregister(&parent->dev); - dev_set_drvdata(&sch->dev, NULL); VFIO_CCW_MSG_EVENT(4, "unbound from subchannel %x.%x.%04x\n", sch->schid.cssid, sch->schid.ssid, diff --git a/drivers/s390/crypto/vfio_ap_ops.c b/drivers/s390/crypto/vfio_ap_ops.c index 2d3c3a79b687..70129135b08d 100644 --- a/drivers/s390/crypto/vfio_ap_ops.c +++ b/drivers/s390/crypto/vfio_ap_ops.c @@ -2088,7 +2088,6 @@ void vfio_ap_mdev_remove_queue(struct ap_device *apdev) } vfio_ap_mdev_reset_queue(q); - dev_set_drvdata(&apdev->device, NULL); kfree(q); release_update_locks_for_mdev(matrix_mdev); } -- 2.25.1