linux-scsi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/3] esas2r: few minor fixes
@ 2014-11-16 13:35 Tomas Henzl
  2014-11-16 13:35 ` [PATCH 1/3] esas2r: fir error handling in do_fm_api Tomas Henzl
                   ` (3 more replies)
  0 siblings, 4 replies; 9+ messages in thread
From: Tomas Henzl @ 2014-11-16 13:35 UTC (permalink / raw)
  To: linux-scsi; +Cc: bgrove

This patchset corrects few minor lapses in the eas2r code.
Without access to the hw it's only compile tested.

Tomas

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

* [PATCH 1/3] esas2r: fir error handling in do_fm_api
  2014-11-16 13:35 [PATCH 0/3] esas2r: few minor fixes Tomas Henzl
@ 2014-11-16 13:35 ` Tomas Henzl
  2014-11-24 20:53   ` Bradley Grove
  2014-11-16 13:35 ` [PATCH 2/3] esas2r: fix an error path in esas2r_ioctl_handler Tomas Henzl
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 9+ messages in thread
From: Tomas Henzl @ 2014-11-16 13:35 UTC (permalink / raw)
  To: linux-scsi; +Cc: bgrove

This patch fixes an error path and rearranges error handling.

Signed-off-by: Tomas Henzl <thenzl@redhat.com>
---
 drivers/scsi/esas2r/esas2r_ioctl.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/scsi/esas2r/esas2r_ioctl.c b/drivers/scsi/esas2r/esas2r_ioctl.c
index d89a0277a8..9ac8207554 100644
--- a/drivers/scsi/esas2r/esas2r_ioctl.c
+++ b/drivers/scsi/esas2r/esas2r_ioctl.c
@@ -117,9 +117,8 @@ static void do_fm_api(struct esas2r_adapter *a, struct esas2r_flash_img *fi)
 
 	rq = esas2r_alloc_request(a);
 	if (rq == NULL) {
-		up(&a->fm_api_semaphore);
 		fi->status = FI_STAT_BUSY;
-		return;
+		goto free_sem;
 	}
 
 	if (fi == &a->firmware.header) {
@@ -135,7 +134,7 @@ static void do_fm_api(struct esas2r_adapter *a, struct esas2r_flash_img *fi)
 		if (a->firmware.header_buff == NULL) {
 			esas2r_debug("failed to allocate header buffer!");
 			fi->status = FI_STAT_BUSY;
-			return;
+			goto free_req;
 		}
 
 		memcpy(a->firmware.header_buff, fi,
@@ -171,9 +170,10 @@ all_done:
 				  a->firmware.header_buff,
 				  (dma_addr_t)a->firmware.header_buff_phys);
 	}
-
-	up(&a->fm_api_semaphore);
+free_req:
 	esas2r_free_request(a, (struct esas2r_request *)rq);
+free_sem:
+	up(&a->fm_api_semaphore);
 	return;
 
 }
-- 
1.9.3


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

* [PATCH 2/3] esas2r: fix an error path in esas2r_ioctl_handler
  2014-11-16 13:35 [PATCH 0/3] esas2r: few minor fixes Tomas Henzl
  2014-11-16 13:35 ` [PATCH 1/3] esas2r: fir error handling in do_fm_api Tomas Henzl
@ 2014-11-16 13:35 ` Tomas Henzl
  2014-11-24 20:56   ` Bradley Grove
  2014-11-16 13:35 ` [PATCH 3/3] esas2r: fix an oversight in setting return value Tomas Henzl
  2014-11-25 14:43 ` [PATCH 0/3] esas2r: few minor fixes Christoph Hellwig
  3 siblings, 1 reply; 9+ messages in thread
From: Tomas Henzl @ 2014-11-16 13:35 UTC (permalink / raw)
  To: linux-scsi; +Cc: bgrove

Is seems strange to manipulate nvram_semaphore when in this place,
this patch fixes it.

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

diff --git a/drivers/scsi/esas2r/esas2r_ioctl.c b/drivers/scsi/esas2r/esas2r_ioctl.c
index 9ac8207554..c88b9f9491 100644
--- a/drivers/scsi/esas2r/esas2r_ioctl.c
+++ b/drivers/scsi/esas2r/esas2r_ioctl.c
@@ -1420,9 +1420,10 @@ int esas2r_ioctl_handler(void *hostdata, int cmd, void __user *arg)
 
 		rq = esas2r_alloc_request(a);
 		if (rq == NULL) {
-			up(&a->nvram_semaphore);
-			ioctl->data.prw.code = 0;
-			break;
+			kfree(ioctl);
+			esas2r_log(ESAS2R_LOG_WARN,
+			   "could not allocate an internal request");
+			return -ENOMEM;
 		}
 
 		code = esas2r_write_params(a, rq,
-- 
1.9.3


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

* [PATCH 3/3] esas2r: fix an oversight in setting return value
  2014-11-16 13:35 [PATCH 0/3] esas2r: few minor fixes Tomas Henzl
  2014-11-16 13:35 ` [PATCH 1/3] esas2r: fir error handling in do_fm_api Tomas Henzl
  2014-11-16 13:35 ` [PATCH 2/3] esas2r: fix an error path in esas2r_ioctl_handler Tomas Henzl
@ 2014-11-16 13:35 ` Tomas Henzl
  2014-11-24 20:58   ` Bradley Grove
  2014-11-24 20:58   ` Bradley Grove
  2014-11-25 14:43 ` [PATCH 0/3] esas2r: few minor fixes Christoph Hellwig
  3 siblings, 2 replies; 9+ messages in thread
From: Tomas Henzl @ 2014-11-16 13:35 UTC (permalink / raw)
  To: linux-scsi; +Cc: bgrove

The patch moves an error code assigment to a 'default' case
in the previous switch statement.

Signed-off-by: Tomas Henzl <thenzl@redhat.com>
---
 drivers/scsi/esas2r/esas2r_ioctl.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/scsi/esas2r/esas2r_ioctl.c b/drivers/scsi/esas2r/esas2r_ioctl.c
index c88b9f9491..baf913047b 100644
--- a/drivers/scsi/esas2r/esas2r_ioctl.c
+++ b/drivers/scsi/esas2r/esas2r_ioctl.c
@@ -1524,9 +1524,12 @@ ioctl_done:
 		case -EINVAL:
 			ioctl->header.return_code = IOCTL_INVALID_PARAM;
 			break;
+
+		default:
+			ioctl->header.return_code = IOCTL_GENERAL_ERROR;
+			break;
 		}
 
-		ioctl->header.return_code = IOCTL_GENERAL_ERROR;
 	}
 
 	/* Always copy the buffer back, if only to pick up the status */
-- 
1.9.3


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

* Re: [PATCH 1/3] esas2r: fir error handling in do_fm_api
  2014-11-16 13:35 ` [PATCH 1/3] esas2r: fir error handling in do_fm_api Tomas Henzl
@ 2014-11-24 20:53   ` Bradley Grove
  0 siblings, 0 replies; 9+ messages in thread
From: Bradley Grove @ 2014-11-24 20:53 UTC (permalink / raw)
  To: Tomas Henzl, linux-scsi, James Bottomley


Looks good.

Acked-by: Bradley Grove <bgrove@attotech.com>

Thanks,
Brad

On 11/16/2014 08:35 AM, Tomas Henzl wrote:
> This patch fixes an error path and rearranges error handling.
>
> Signed-off-by: Tomas Henzl <thenzl@redhat.com>
> ---
>   drivers/scsi/esas2r/esas2r_ioctl.c | 10 +++++-----
>   1 file changed, 5 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/scsi/esas2r/esas2r_ioctl.c b/drivers/scsi/esas2r/esas2r_ioctl.c
> index d89a0277a8..9ac8207554 100644
> --- a/drivers/scsi/esas2r/esas2r_ioctl.c
> +++ b/drivers/scsi/esas2r/esas2r_ioctl.c
> @@ -117,9 +117,8 @@ static void do_fm_api(struct esas2r_adapter *a, struct esas2r_flash_img *fi)
>
>   	rq = esas2r_alloc_request(a);
>   	if (rq == NULL) {
> -		up(&a->fm_api_semaphore);
>   		fi->status = FI_STAT_BUSY;
> -		return;
> +		goto free_sem;
>   	}
>
>   	if (fi == &a->firmware.header) {
> @@ -135,7 +134,7 @@ static void do_fm_api(struct esas2r_adapter *a, struct esas2r_flash_img *fi)
>   		if (a->firmware.header_buff == NULL) {
>   			esas2r_debug("failed to allocate header buffer!");
>   			fi->status = FI_STAT_BUSY;
> -			return;
> +			goto free_req;
>   		}
>
>   		memcpy(a->firmware.header_buff, fi,
> @@ -171,9 +170,10 @@ all_done:
>   				  a->firmware.header_buff,
>   				  (dma_addr_t)a->firmware.header_buff_phys);
>   	}
> -
> -	up(&a->fm_api_semaphore);
> +free_req:
>   	esas2r_free_request(a, (struct esas2r_request *)rq);
> +free_sem:
> +	up(&a->fm_api_semaphore);
>   	return;
>
>   }
>


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

* Re: [PATCH 2/3] esas2r: fix an error path in esas2r_ioctl_handler
  2014-11-16 13:35 ` [PATCH 2/3] esas2r: fix an error path in esas2r_ioctl_handler Tomas Henzl
@ 2014-11-24 20:56   ` Bradley Grove
  0 siblings, 0 replies; 9+ messages in thread
From: Bradley Grove @ 2014-11-24 20:56 UTC (permalink / raw)
  To: Tomas Henzl, linux-scsi, James Bottomley


Acked-by: Bradley Grove <bgrove@attotech.com>

Thanks,
Brad


On 11/16/2014 08:35 AM, Tomas Henzl wrote:
> Is seems strange to manipulate nvram_semaphore when in this place,
> this patch fixes it.
>
> Signed-off-by: Tomas Henzl <thenzl@redhat.com>
> ---
>   drivers/scsi/esas2r/esas2r_ioctl.c | 7 ++++---
>   1 file changed, 4 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/scsi/esas2r/esas2r_ioctl.c b/drivers/scsi/esas2r/esas2r_ioctl.c
> index 9ac8207554..c88b9f9491 100644
> --- a/drivers/scsi/esas2r/esas2r_ioctl.c
> +++ b/drivers/scsi/esas2r/esas2r_ioctl.c
> @@ -1420,9 +1420,10 @@ int esas2r_ioctl_handler(void *hostdata, int cmd, void __user *arg)
>
>   		rq = esas2r_alloc_request(a);
>   		if (rq == NULL) {
> -			up(&a->nvram_semaphore);
> -			ioctl->data.prw.code = 0;
> -			break;
> +			kfree(ioctl);
> +			esas2r_log(ESAS2R_LOG_WARN,
> +			   "could not allocate an internal request");
> +			return -ENOMEM;
>   		}
>
>   		code = esas2r_write_params(a, rq,
>


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

* Re: [PATCH 3/3] esas2r: fix an oversight in setting return value
  2014-11-16 13:35 ` [PATCH 3/3] esas2r: fix an oversight in setting return value Tomas Henzl
@ 2014-11-24 20:58   ` Bradley Grove
  2014-11-24 20:58   ` Bradley Grove
  1 sibling, 0 replies; 9+ messages in thread
From: Bradley Grove @ 2014-11-24 20:58 UTC (permalink / raw)
  To: Tomas Henzl, linux-scsi

Acked-by: Bradley Grove <bgrove@attotech.com>

Thanks,
Brad

On 11/16/2014 08:35 AM, Tomas Henzl wrote:
> The patch moves an error code assigment to a 'default' case
> in the previous switch statement.
>
> Signed-off-by: Tomas Henzl <thenzl@redhat.com>
> ---
>   drivers/scsi/esas2r/esas2r_ioctl.c | 5 ++++-
>   1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/scsi/esas2r/esas2r_ioctl.c b/drivers/scsi/esas2r/esas2r_ioctl.c
> index c88b9f9491..baf913047b 100644
> --- a/drivers/scsi/esas2r/esas2r_ioctl.c
> +++ b/drivers/scsi/esas2r/esas2r_ioctl.c
> @@ -1524,9 +1524,12 @@ ioctl_done:
>   		case -EINVAL:
>   			ioctl->header.return_code = IOCTL_INVALID_PARAM;
>   			break;
> +
> +		default:
> +			ioctl->header.return_code = IOCTL_GENERAL_ERROR;
> +			break;
>   		}
>
> -		ioctl->header.return_code = IOCTL_GENERAL_ERROR;
>   	}
>
>   	/* Always copy the buffer back, if only to pick up the status */
>


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

* Re: [PATCH 3/3] esas2r: fix an oversight in setting return value
  2014-11-16 13:35 ` [PATCH 3/3] esas2r: fix an oversight in setting return value Tomas Henzl
  2014-11-24 20:58   ` Bradley Grove
@ 2014-11-24 20:58   ` Bradley Grove
  1 sibling, 0 replies; 9+ messages in thread
From: Bradley Grove @ 2014-11-24 20:58 UTC (permalink / raw)
  To: Tomas Henzl, linux-scsi, James Bottomley

Acked-by: Bradley Grove <bgrove@attotech.com>

Thanks,
Brad

On 11/16/2014 08:35 AM, Tomas Henzl wrote:
> The patch moves an error code assigment to a 'default' case
> in the previous switch statement.
>
> Signed-off-by: Tomas Henzl <thenzl@redhat.com>
> ---
>   drivers/scsi/esas2r/esas2r_ioctl.c | 5 ++++-
>   1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/scsi/esas2r/esas2r_ioctl.c b/drivers/scsi/esas2r/esas2r_ioctl.c
> index c88b9f9491..baf913047b 100644
> --- a/drivers/scsi/esas2r/esas2r_ioctl.c
> +++ b/drivers/scsi/esas2r/esas2r_ioctl.c
> @@ -1524,9 +1524,12 @@ ioctl_done:
>   		case -EINVAL:
>   			ioctl->header.return_code = IOCTL_INVALID_PARAM;
>   			break;
> +
> +		default:
> +			ioctl->header.return_code = IOCTL_GENERAL_ERROR;
> +			break;
>   		}
>
> -		ioctl->header.return_code = IOCTL_GENERAL_ERROR;
>   	}
>
>   	/* Always copy the buffer back, if only to pick up the status */
>


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

* Re: [PATCH 0/3] esas2r: few minor fixes
  2014-11-16 13:35 [PATCH 0/3] esas2r: few minor fixes Tomas Henzl
                   ` (2 preceding siblings ...)
  2014-11-16 13:35 ` [PATCH 3/3] esas2r: fix an oversight in setting return value Tomas Henzl
@ 2014-11-25 14:43 ` Christoph Hellwig
  3 siblings, 0 replies; 9+ messages in thread
From: Christoph Hellwig @ 2014-11-25 14:43 UTC (permalink / raw)
  To: Tomas Henzl; +Cc: linux-scsi, bgrove

On Sun, Nov 16, 2014 at 02:35:31PM +0100, Tomas Henzl wrote:
> This patchset corrects few minor lapses in the eas2r code.
> Without access to the hw it's only compile tested.

Thanks, applied the series to drivers-for-3.19

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

end of thread, other threads:[~2014-11-25 14:43 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-11-16 13:35 [PATCH 0/3] esas2r: few minor fixes Tomas Henzl
2014-11-16 13:35 ` [PATCH 1/3] esas2r: fir error handling in do_fm_api Tomas Henzl
2014-11-24 20:53   ` Bradley Grove
2014-11-16 13:35 ` [PATCH 2/3] esas2r: fix an error path in esas2r_ioctl_handler Tomas Henzl
2014-11-24 20:56   ` Bradley Grove
2014-11-16 13:35 ` [PATCH 3/3] esas2r: fix an oversight in setting return value Tomas Henzl
2014-11-24 20:58   ` Bradley Grove
2014-11-24 20:58   ` Bradley Grove
2014-11-25 14:43 ` [PATCH 0/3] esas2r: few minor fixes Christoph Hellwig

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).