Re: [PATCH v6 30/30] mtd: rawnand: Allocate the best interface configuration dynamically

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, 29 May 2020 01:16:12 +0200
Miquel Raynal <miquel.raynal@xxxxxxxxxxx> wrote:

>  
> @@ -947,7 +949,8 @@ static int nand_reset_interface(struct nand_chip *chip, int chipnr)
>   */
>  static int nand_setup_interface(struct nand_chip *chip, int chipnr)
>  {
> -	u8 mode = chip->interface_config.timings.mode;
> +	const struct nand_controller_ops *ops = chip->controller->ops;
> +	u8 mode = chip->best_interface_config->timings.mode;

I didn't check, but I assume it's safe to dereference
->best_interface_config here (IOW, ->best_interface_config is
guaranteed to be != NULL).

>  	u8 tmode_param[ONFI_SUBFEATURE_PARAM_LEN] = { mode, };
>  	int ret;
>  

>  
>  /**
> @@ -2523,8 +2542,8 @@ int nand_reset(struct nand_chip *chip, int chipnr)
>  	 * nand_setup_interface() uses ->set/get_features() which would
>  	 * fail anyway as the parameter page is not available yet.
>  	 */
> -	if (!memcmp(&chip->interface_config, nand_get_reset_interface(),
> -		    sizeof(chip->interface_config)))
> +	if (!chip->best_interface_config ||
> +	    chip->best_interface_config == nand_get_reset_interface())

I think 'chip->best_interface_config == nand_get_reset_interface()' is
never true.

______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/



[Index of Archives]     [LARTC]     [Bugtraq]     [Yosemite Forum]     [Photo]

  Powered by Linux