All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 2/4] scsi: pm8001: fix update_flash
@ 2014-07-07 15:19 Tomas Henzl
  2014-07-10 10:25 ` Suresh Thiagarajan
  0 siblings, 1 reply; 2+ messages in thread
From: Tomas Henzl @ 2014-07-07 15:19 UTC (permalink / raw)
  To: linux-scsi
  Cc: xjtuwjp, Vasanthalakshmi.Tharmarajan, Suresh.Thiagarajan,
	Viswas.G, 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.

Signed-off-by: Tomas Henzl <thenzl@redhat.com>
---
 drivers/scsi/pm8001/pm8001_ctl.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/scsi/pm8001/pm8001_ctl.c b/drivers/scsi/pm8001/pm8001_ctl.c
index 211ffd6..e9753bd 100644
--- a/drivers/scsi/pm8001/pm8001_ctl.c
+++ b/drivers/scsi/pm8001/pm8001_ctl.c
@@ -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


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* RE: [PATCH 2/4] scsi: pm8001: fix update_flash
  2014-07-07 15:19 [PATCH 2/4] scsi: pm8001: fix update_flash Tomas Henzl
@ 2014-07-10 10:25 ` Suresh Thiagarajan
  0 siblings, 0 replies; 2+ messages in thread
From: Suresh Thiagarajan @ 2014-07-10 10:25 UTC (permalink / raw)
  To: Tomas Henzl, linux-scsi; +Cc: xjtuwjp, Vasanthalakshmi Tharmarajan, Viswas G



On Mon, Jul 7, 2014 at 8:49 PM, Tomas Henzl <thenzl@redhat.com> wrote:
> 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.
Acked-by: Suresh Thiagarajan<Suresh.Thiagarajan@pmcs.com>

>
> Signed-off-by: Tomas Henzl <thenzl@redhat.com>
> ---
>  drivers/scsi/pm8001/pm8001_ctl.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/scsi/pm8001/pm8001_ctl.c b/drivers/scsi/pm8001/pm8001_ctl.c
> index 211ffd6..e9753bd 100644
> --- a/drivers/scsi/pm8001/pm8001_ctl.c
> +++ b/drivers/scsi/pm8001/pm8001_ctl.c
> @@ -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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2014-07-10 10:25 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-07-07 15:19 [PATCH 2/4] scsi: pm8001: fix update_flash Tomas Henzl
2014-07-10 10:25 ` Suresh Thiagarajan

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.