All of lore.kernel.org
 help / color / mirror / Atom feed
From: Sudeep Dutt <sudeep.dutt@intel.com>
To: Sudip Mukherjee <sudipm.mukherjee@gmail.com>
Cc: Sudeep Dutt <sudeep.dutt@intel.com>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	linux-kernel@vger.kernel.org, "Dixit,
	Ashutosh" <ashutosh.dixit@intel.com>
Subject: Re: [PATCH char-misc-next 4/4] misc: mic: use common error path
Date: Fri, 11 Dec 2015 18:46:25 -0800	[thread overview]
Message-ID: <1449888385.93285.547.camel@localhost> (raw)
In-Reply-To: <1448279672-12208-4-git-send-email-sudipm.mukherjee@gmail.com>

On Mon, 2015-11-23 at 17:24 +0530, Sudip Mukherjee wrote:
> Instead of calling release_firmware() on every error and then jumping
> lets have a common release_firmware() in the error path.
> This patch also fixes a memory leak where we missed release_firmware()
> if mic_x100_load_command_line() fails.
> 

Thanks for this patch series Sudip. All 4 patches look good.

Reviewed-by: Sudeep Dutt <sudeep.dutt@intel.com>


> Signed-off-by: Sudip Mukherjee <sudip@vectorindia.org>
> ---
>  drivers/misc/mic/host/mic_x100.c | 13 +++++++------
>  1 file changed, 7 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/misc/mic/host/mic_x100.c b/drivers/misc/mic/host/mic_x100.c
> index 37fa898..82a973c 100644
> --- a/drivers/misc/mic/host/mic_x100.c
> +++ b/drivers/misc/mic/host/mic_x100.c
> @@ -463,8 +463,7 @@ mic_x100_load_firmware(struct mic_device *mdev, const char *buf)
>  		rc = -EINVAL;
>  		dev_err(&mdev->pdev->dev, "%s %d rc %d bootaddr 0x%x\n",
>  			__func__, __LINE__, rc, mdev->bootaddr);
> -		release_firmware(fw);
> -		goto done;
> +		goto error;
>  	}
>  	memcpy_toio(mdev->aper.va + mdev->bootaddr, fw->data, fw->size);
>  	mdev->ops->write_spad(mdev, MIC_X100_FW_SIZE, fw->size);
> @@ -472,22 +471,24 @@ mic_x100_load_firmware(struct mic_device *mdev, const char *buf)
>  		rc = -EINVAL;
>  		dev_err(&mdev->pdev->dev, "%s %d rc %d\n",
>  			__func__, __LINE__, rc);
> -		release_firmware(fw);
> -		goto done;
> +		goto error;
>  	}
>  	/* load command line */
>  	rc = mic_x100_load_command_line(mdev, fw);
>  	if (rc) {
>  		dev_err(&mdev->pdev->dev, "%s %d rc %d\n",
>  			__func__, __LINE__, rc);
> -		goto done;
> +		goto error;
>  	}
>  	release_firmware(fw);
>  	/* load ramdisk */
>  	if (mdev->cosm_dev->ramdisk)
>  		rc = mic_x100_load_ramdisk(mdev);
>  
> -done:
> +	return rc;
> +
> +error:
> +	release_firmware(fw);
>  	return rc;
>  }
>  



  reply	other threads:[~2015-12-12  2:49 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-11-23 11:54 [PATCH char-misc-next 1/4] misc: mic: remove unneeded debug message Sudip Mukherjee
2015-11-23 11:54 ` [PATCH char-misc-next 2/4] misc: mic: return error properly Sudip Mukherjee
2015-11-23 11:54 ` [PATCH char-misc-next 3/4] misc: mic: return error directly Sudip Mukherjee
2015-11-23 11:54 ` [PATCH char-misc-next 4/4] misc: mic: use common error path Sudip Mukherjee
2015-12-12  2:46   ` Sudeep Dutt [this message]
2016-01-06 12:06     ` Sudip Mukherjee

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=1449888385.93285.547.camel@localhost \
    --to=sudeep.dutt@intel.com \
    --cc=ashutosh.dixit@intel.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=sudipm.mukherjee@gmail.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.