Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1290069 > unrolled thread

Re: [PATCH char-misc-next 4/4] misc: mic: use common error path

Started bySudeep Dutt <sudeep.dutt@intel.com>
First post2015-12-12 03:50 +0100
Last post2015-12-12 03:50 +0100
Articles 1 — 1 participant

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: [PATCH char-misc-next 4/4] misc: mic: use common error path Sudeep Dutt <sudeep.dutt@intel.com> - 2015-12-12 03:50 +0100

#1290069 — Re: [PATCH char-misc-next 4/4] misc: mic: use common error path

FromSudeep Dutt <sudeep.dutt@intel.com>
Date2015-12-12 03:50 +0100
SubjectRe: [PATCH char-misc-next 4/4] misc: mic: use common error path
Message-ID<qEIpX-4ya-7@gated-at.bofh.it>
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;
>  }
>  


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

[toc] | [standalone]


Back to top | Article view | linux.kernel


csiph-web