Skip to contentSkip to conversation

scsi: pm8001: fix update_flash

PATCH In review Tomas Henzl 2 participants 2 messages Jul 7, 2014 – Jul 10, 2014

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 2/4 scsi: pm8001: fix update_flash

The driver checks the return valu, but after he tries to wait_for_completion which might never happen.
Also the ioctlbuffer is freed at the end of the function,
so the first removal is not needed.

---
 drivers/scsi/pm8001/pm8001_ctl.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/scsi/pm8001/pm8001_ctl.c +3 -3
index 211ffd6..e9753bd 100644
@@ -617,11 +617,11 @@ static int pm8001_update_flash(struct pm8001_hba_info *pm8001_ha)
 
 		pm8001_ha->nvmd_completion = &completion;
 		ret = PM8001_CHIP_DISP->fw_flash_update_req(pm8001_ha, payload);
+		if (ret)
+			break;
 		wait_for_completion(&completion);
-		if (ret || (fwControl->retcode > FLASH_UPDATE_IN_PROGRESS)) {
+		if (fwControl->retcode > FLASH_UPDATE_IN_PROGRESS) {
 			ret = fwControl->retcode;
-			kfree(ioctlbuffer);
-			ioctlbuffer = NULL;
 			break;
 		}
 	}
Signature · 1 line
1.8.3.1
Acked-by on v1 2/4
#1 lore raw
Quoted 4 lines · Tomas Henzl

The driver checks the return valu, but after he tries to wait_for_completion which might never happen.
Also the ioctlbuffer is freed at the end of the function,
so the first removal is not needed.

Looks good. Thanks Tomas.

Quoted 27 lines
---
 drivers/scsi/pm8001/pm8001_ctl.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/scsi/pm8001/pm8001_ctl.c +3 -4
index 211ffd6..e9753bd 100644
@@ -617,11 +617,11 @@ static int pm8001_update_flash(struct pm8001_hba_info *pm8001_ha)
 
                pm8001_ha->nvmd_completion = &completion;
                ret = PM8001_CHIP_DISP->fw_flash_update_req(pm8001_ha, payload);
+               if (ret)
+                       break;
                wait_for_completion(&completion);
-               if (ret || (fwControl->retcode > FLASH_UPDATE_IN_PROGRESS)) {
+               if (fwControl->retcode > FLASH_UPDATE_IN_PROGRESS) {
                        ret = fwControl->retcode;
-                       kfree(ioctlbuffer);
-                       ioctlbuffer = NULL;
                        break;
                }
        }
--

1.8.3.1