lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Thu, 26 Dec 2013 10:32:07 +0800
From:	Huang Shijie <b32955@...escale.com>
To:	Caizhiyong <caizhiyong@...ilicon.com>
CC:	"linux-mtd@...ts.infradead.org" <linux-mtd@...ts.infradead.org>,
	Brian Norris <computersforpeace@...il.com>,
	"Wanglin (Albert)" <albert.wanglin@...ilicon.com>,
	David Woodhouse <David.Woodhouse@...el.com>,
	"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
	Artem Bityutskiy <artem.bityutskiy@...ux.intel.com>
Subject: Re: [PATCH] mtd: nand: remove unused function input parameter

On Wed, Dec 25, 2013 at 12:40:50PM +0000, Caizhiyong wrote:
> From: Cai Zhiyong <caizhiyong@...wei.com>
> Date: Wed, 25 Dec 2013 20:11:15 +0800
> Subject: [PATCH] mtd: nand: remove unused function input parameter
> 
> The nand_get_flash_type parameter "busw" input value is not used by any
> branch, and it is updated before use it in the function, so remove it, 
> define the "busw" as an internal variable.
> 
> Signed-off-by: Cai Zhiyong <caizhiyong@...wei.com>
> ---
>  drivers/mtd/nand/nand_base.c | 12 +++++-------
>  1 file changed, 5 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/mtd/nand/nand_base.c b/drivers/mtd/nand/nand_base.c
> index 9b3bb3c..a123afa 100644
> --- a/drivers/mtd/nand/nand_base.c
> +++ b/drivers/mtd/nand/nand_base.c
> @@ -3337,10 +3337,10 @@ static bool find_full_id_nand(struct mtd_info *mtd, struct nand_chip *chip,
>   */
>  static struct nand_flash_dev *nand_get_flash_type(struct mtd_info *mtd,
>  						  struct nand_chip *chip,
> -						  int busw,
>  						  int *maf_id, int *dev_id,
>  						  struct nand_flash_dev *type)
>  {
> +	int busw;
>  	int i, maf_idx;
>  	u8 id_data[8];
>  
> @@ -3497,18 +3497,16 @@ ident_done:
>  int nand_scan_ident(struct mtd_info *mtd, int maxchips,
>  		    struct nand_flash_dev *table)
>  {
> -	int i, busw, nand_maf_id, nand_dev_id;
> +	int i, nand_maf_id, nand_dev_id;
>  	struct nand_chip *chip = mtd->priv;
>  	struct nand_flash_dev *type;
>  
> -	/* Get buswidth to select the correct functions */
> -	busw = chip->options & NAND_BUSWIDTH_16;
>  	/* Set the default functions */
> -	nand_set_defaults(chip, busw);
> +	nand_set_defaults(chip, chip->options & NAND_BUSWIDTH_16);
>  
>  	/* Read the flash type */
> -	type = nand_get_flash_type(mtd, chip, busw,
> -				&nand_maf_id, &nand_dev_id, table);
> +	type = nand_get_flash_type(mtd, chip, &nand_maf_id,
> +				   &nand_dev_id, table);
I think the "busw" is to make the code more readable, since the nand_set_defaults
also needs a busw.

Let Brian judge it.

thanks
Huang Shijie


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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ