diff mbox

csiostor: fix an error code in csio_hw_init()

Message ID 20150414143219.GA30421@mwanda (mailing list archive)
State New, archived
Headers show

Commit Message

Dan Carpenter April 14, 2015, 2:32 p.m. UTC
We should return -ENOMEM if kzalloc() fails here instead of returning
success.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Comments

Tomas Henzl April 16, 2015, 12:22 p.m. UTC | #1
On 04/14/2015 04:32 PM, Dan Carpenter wrote:
> We should return -ENOMEM if kzalloc() fails here instead of returning
> success.
>
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
>
> diff --git a/drivers/scsi/csiostor/csio_hw.c b/drivers/scsi/csiostor/csio_hw.c
> index 2e66f34..622bdab 100644
> --- a/drivers/scsi/csiostor/csio_hw.c
> +++ b/drivers/scsi/csiostor/csio_hw.c
> @@ -3928,6 +3928,7 @@ csio_hw_init(struct csio_hw *hw)
>  
>  		evt_entry = kzalloc(sizeof(struct csio_evt_msg), GFP_KERNEL);
>  		if (!evt_entry) {
> +			rv = -ENOMEM;
>  			csio_err(hw, "Failed to initialize eventq");
>  			goto err_evtq_cleanup;
>  		}
> --
> To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reviewed-by: Tomas Henzl <thenzl@redhat.com>

Tomas

--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/drivers/scsi/csiostor/csio_hw.c b/drivers/scsi/csiostor/csio_hw.c
index 2e66f34..622bdab 100644
--- a/drivers/scsi/csiostor/csio_hw.c
+++ b/drivers/scsi/csiostor/csio_hw.c
@@ -3928,6 +3928,7 @@  csio_hw_init(struct csio_hw *hw)
 
 		evt_entry = kzalloc(sizeof(struct csio_evt_msg), GFP_KERNEL);
 		if (!evt_entry) {
+			rv = -ENOMEM;
 			csio_err(hw, "Failed to initialize eventq");
 			goto err_evtq_cleanup;
 		}