All of lore.kernel.org
 help / color / mirror / Atom feed
From: Bart Van Assche <bvanassche@acm.org>
To: Saurav Kashyap <saurav.kashyap@qlogic.com>
Cc: Chad Dupuis <chad.dupuis@qlogic.com>,
	linux-scsi <linux-scsi@vger.kernel.org>
Subject: Re: [PATCH] qla2x00t: Fix a memory leak in an error path
Date: Fri, 17 May 2013 14:03:47 +0200	[thread overview]
Message-ID: <51961CA3.9060709@acm.org> (raw)
In-Reply-To: <F5D084D6342F9B479C34599BB0A03E4D3538B3ED@AVMB1.qlogic.org>

On 05/17/13 07:00, Saurav Kashyap wrote:
> Instead of doing this I would move this check to the top of the function,
> something like this
> -----------------8<----------
> diff --git a/drivers/scsi/qla2xxx/qla_bsg.c
> b/drivers/scsi/qla2xxx/qla_bsg.c
> index 371bb86..b5f84ae 100644
> --- a/drivers/scsi/qla2xxx/qla_bsg.c
> +++ b/drivers/scsi/qla2xxx/qla_bsg.c
> @@ -255,6 +255,12 @@ qla2x00_process_els(struct fc_bsg_job *bsg_job)
>          int rval =  (DRIVER_ERROR << 16);
>          uint16_t nextlid = 0;
>
>
> +       if (!vha->flags.online) {
> +               ql_log(ql_log_warn, vha, 0x7005, "Host not online.\n");
> +               rval = -EIO;
> +               goto done;
> +       }
> +
>          if (bsg_job->request->msgcode == FC_BSG_RPT_ELS) {
>                  rport = bsg_job->rport;
>                  fcport = *(fc_port_t **) rport->dd_data;
> @@ -326,12 +332,6 @@ qla2x00_process_els(struct fc_bsg_job *bsg_job)
>                          NPH_FABRIC_CONTROLLER : NPH_F_PORT;
>          }
>
>
> -       if (!vha->flags.online) {
> -               ql_log(ql_log_warn, vha, 0x7005, "Host not online.\n");
> -               rval = -EIO;
> -               goto done;
> -       }
> -
>          req_sg_cnt =
>                  dma_map_sg(&ha->pdev->dev,
> bsg_job->request_payload.sg_list,
>                  bsg_job->request_payload.sg_cnt, DMA_TO_DEVICE);
>
> ----------------8<---------

Hello Saurav,

I will update the patch, retest and repost it. Thanks for the feedback.

Bart.

      reply	other threads:[~2013-05-17 12:03 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-05-11 12:38 [PATCH] qla2x00t: Fix a memory leak in an error path Bart Van Assche
2013-05-17  5:00 ` Saurav Kashyap
2013-05-17 12:03   ` Bart Van Assche [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=51961CA3.9060709@acm.org \
    --to=bvanassche@acm.org \
    --cc=chad.dupuis@qlogic.com \
    --cc=linux-scsi@vger.kernel.org \
    --cc=saurav.kashyap@qlogic.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.