Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756045AbbLLCtq (ORCPT ); Fri, 11 Dec 2015 21:49:46 -0500 Received: from mga02.intel.com ([134.134.136.20]:47703 "EHLO mga02.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754710AbbLLCsl (ORCPT ); Fri, 11 Dec 2015 21:48:41 -0500 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.20,416,1444719600"; d="scan'208";a="859194886" Subject: Re: [PATCH char-misc-next 4/4] misc: mic: use common error path From: Sudeep Dutt To: Sudip Mukherjee Cc: Sudeep Dutt , Greg Kroah-Hartman , linux-kernel@vger.kernel.org, "Dixit, Ashutosh" In-Reply-To: <1448279672-12208-4-git-send-email-sudipm.mukherjee@gmail.com> References: <1448279672-12208-1-git-send-email-sudipm.mukherjee@gmail.com> <1448279672-12208-4-git-send-email-sudipm.mukherjee@gmail.com> Content-Type: text/plain; charset="UTF-8" Date: Fri, 11 Dec 2015 18:46:25 -0800 Message-ID: <1449888385.93285.547.camel@localhost> Mime-Version: 1.0 X-Mailer: Evolution 2.28.3 (2.28.3-30.el6) Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2120 Lines: 67 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 > Signed-off-by: Sudip Mukherjee > --- > 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/