Merge branches 'work.misc' and 'work.dcache' of git://git.kernel.org/pub/scm/linux...
[sfrench/cifs-2.6.git] / drivers / s390 / block / dasd_eckd.c
index bbf95b78ef5d9e4c5903e466e7de3f71b615c9ce..4e7b55a14b1a46d40920fde48460fa2400c46f84 100644 (file)
@@ -1780,6 +1780,9 @@ static void dasd_eckd_uncheck_device(struct dasd_device *device)
        struct dasd_eckd_private *private = device->private;
        int i;
 
+       if (!private)
+               return;
+
        dasd_alias_disconnect_device_from_lcu(device);
        private->ned = NULL;
        private->sneq = NULL;
@@ -2035,8 +2038,11 @@ static int dasd_eckd_basic_to_ready(struct dasd_device *device)
 
 static int dasd_eckd_online_to_ready(struct dasd_device *device)
 {
-       cancel_work_sync(&device->reload_device);
-       cancel_work_sync(&device->kick_validate);
+       if (cancel_work_sync(&device->reload_device))
+               dasd_put_device(device);
+       if (cancel_work_sync(&device->kick_validate))
+               dasd_put_device(device);
+
        return 0;
 };
 
@@ -3535,7 +3541,7 @@ static int prepare_itcw(struct itcw *itcw,
 
        dcw = itcw_add_dcw(itcw, pfx_cmd, 0,
                     &pfxdata, sizeof(pfxdata), total_data_size);
-       return PTR_RET(dcw);
+       return PTR_ERR_OR_ZERO(dcw);
 }
 
 static struct dasd_ccw_req *dasd_eckd_build_cp_tpm_track(