Re: [PATCH -next] mtd: rawnand: macronix: Use match_string() helper to simplify the code

From: kbuild test robot
Date: Mon Dec 30 2019 - 07:38:44 EST


Hi YueHaibing,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on next-20191220]
[also build test WARNING on linus/master v5.5-rc4]
[if your patch is applied to the wrong git tree, please drop us a note to help
improve the system. BTW, we also suggest to use '--base' option to specify the
base tree in git format-patch, please see https://stackoverflow.com/a/37406982]

url: https://github.com/0day-ci/linux/commits/YueHaibing/mtd-rawnand-macronix-Use-match_string-helper-to-simplify-the-code/20191230-111849
base: 7ddd09fc4b745fb1d8942f95389583e08412e0cd

If you fix the issue, kindly add following tag
Reported-by: kbuild test robot <lkp@xxxxxxxxx>

smatch warnings:
drivers/mtd/nand/raw/nand_macronix.c:85 macronix_nand_fix_broken_get_timings() warn: unsigned 'i' is never less than zero.

vim +/i +85 drivers/mtd/nand/raw/nand_macronix.c

54
55 /*
56 * Macronix AC series does not support using SET/GET_FEATURES to change
57 * the timings unlike what is declared in the parameter page. Unflag
58 * this feature to avoid unnecessary downturns.
59 */
60 static void macronix_nand_fix_broken_get_timings(struct nand_chip *chip)
61 {
62 unsigned int i;
63 static const char * const broken_get_timings[] = {
64 "MX30LF1G18AC",
65 "MX30LF1G28AC",
66 "MX30LF2G18AC",
67 "MX30LF2G28AC",
68 "MX30LF4G18AC",
69 "MX30LF4G28AC",
70 "MX60LF8G18AC",
71 "MX30UF1G18AC",
72 "MX30UF1G16AC",
73 "MX30UF2G18AC",
74 "MX30UF2G16AC",
75 "MX30UF4G18AC",
76 "MX30UF4G16AC",
77 "MX30UF4G28AC",
78 };
79
80 if (!chip->parameters.supports_set_get_features)
81 return;
82
83 i = match_string(broken_get_timings, ARRAY_SIZE(broken_get_timings),
84 chip->parameters.model);
> 85 if (i < 0)
86 return;
87
88 bitmap_clear(chip->parameters.get_feature_list,
89 ONFI_FEATURE_ADDR_TIMING_MODE, 1);
90 bitmap_clear(chip->parameters.set_feature_list,
91 ONFI_FEATURE_ADDR_TIMING_MODE, 1);
92 }
93

---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/hyperkitty/list/kbuild-all@xxxxxxxxxxxx Intel Corporation