[<prev] [next>] [day] [month] [year] [list]
Message-ID: <202009080452.61u3M2JS%lkp@intel.com>
Date: Tue, 8 Sep 2020 04:51:57 +0800
From: kernel test robot <lkp@...el.com>
To: Linus Walleij <linus.walleij@...aro.org>
Cc: kbuild-all@...ts.01.org, linux-kernel@...r.kernel.org,
Richard Weinberger <richard@....at>
Subject: drivers/mtd/parsers/bcm47xxpart.c:217:21: sparse: sparse: cast to
restricted __le32
Hi Linus,
First bad commit (maybe != root cause):
tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: f4d51dffc6c01a9e94650d95ce0104964f8ae822
commit: 11f74023888f4e50fd33d3428ce473a10e1f1969 mtd: parsers: Move BCM47xx parser
date: 12 months ago
config: mips-randconfig-s032-20200908 (attached as .config)
compiler: mipsel-linux-gcc (GCC) 9.3.0
reproduce:
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# apt-get install sparse
# sparse version: v0.6.2-191-g10164920-dirty
git checkout 11f74023888f4e50fd33d3428ce473a10e1f1969
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' ARCH=mips
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@...el.com>
sparse warnings: (new ones prefixed by >>)
>> drivers/mtd/parsers/bcm47xxpart.c:217:21: sparse: sparse: cast to restricted __le32
# https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=11f74023888f4e50fd33d3428ce473a10e1f1969
git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
git fetch --no-tags linus master
git checkout 11f74023888f4e50fd33d3428ce473a10e1f1969
vim +217 drivers/mtd/parsers/bcm47xxpart.c
89a0d9a9f1941a drivers/mtd/bcm47xxpart.c Rafał Miłecki 2017-01-10 85
3cf7f1314ed885 drivers/mtd/bcm47xxpart.c Rafał Miłecki 2012-08-30 86 static int bcm47xxpart_parse(struct mtd_info *master,
b9adf469f8abb8 drivers/mtd/bcm47xxpart.c Brian Norris 2015-12-04 87 const struct mtd_partition **pparts,
3cf7f1314ed885 drivers/mtd/bcm47xxpart.c Rafał Miłecki 2012-08-30 88 struct mtd_part_parser_data *data)
3cf7f1314ed885 drivers/mtd/bcm47xxpart.c Rafał Miłecki 2012-08-30 89 {
3cf7f1314ed885 drivers/mtd/bcm47xxpart.c Rafał Miłecki 2012-08-30 90 struct mtd_partition *parts;
3cf7f1314ed885 drivers/mtd/bcm47xxpart.c Rafał Miłecki 2012-08-30 91 uint8_t i, curr_part = 0;
3cf7f1314ed885 drivers/mtd/bcm47xxpart.c Rafał Miłecki 2012-08-30 92 uint32_t *buf;
3cf7f1314ed885 drivers/mtd/bcm47xxpart.c Rafał Miłecki 2012-08-30 93 size_t bytes_read;
3cf7f1314ed885 drivers/mtd/bcm47xxpart.c Rafał Miłecki 2012-08-30 94 uint32_t offset;
25bad1d3c9f561 drivers/mtd/bcm47xxpart.c Hauke Mehrtens 2013-01-24 95 uint32_t blocksize = master->erasesize;
89a0d9a9f1941a drivers/mtd/bcm47xxpart.c Rafał Miłecki 2017-01-10 96 int trx_parts[2]; /* Array with indexes of TRX partitions */
89a0d9a9f1941a drivers/mtd/bcm47xxpart.c Rafał Miłecki 2017-01-10 97 int trx_num = 0; /* Number of found TRX partitions */
91d542f4dcc231 drivers/mtd/bcm47xxpart.c Rafał Miłecki 2013-03-07 98 int possible_nvram_sizes[] = { 0x8000, 0xF000, 0x10000, };
36bcc0c9c2bc8f drivers/mtd/bcm47xxpart.c Rafał Miłecki 2015-12-06 99 int err;
3cf7f1314ed885 drivers/mtd/bcm47xxpart.c Rafał Miłecki 2012-08-30 100
16bd87b3a352b5 drivers/mtd/bcm47xxpart.c Rafał Miłecki 2014-12-08 101 /*
16bd87b3a352b5 drivers/mtd/bcm47xxpart.c Rafał Miłecki 2014-12-08 102 * Some really old flashes (like AT45DB*) had smaller erasesize-s, but
16bd87b3a352b5 drivers/mtd/bcm47xxpart.c Rafał Miłecki 2014-12-08 103 * partitions were aligned to at least 0x1000 anyway.
16bd87b3a352b5 drivers/mtd/bcm47xxpart.c Rafał Miłecki 2014-12-08 104 */
16bd87b3a352b5 drivers/mtd/bcm47xxpart.c Rafał Miłecki 2014-12-08 105 if (blocksize < 0x1000)
16bd87b3a352b5 drivers/mtd/bcm47xxpart.c Rafał Miłecki 2014-12-08 106 blocksize = 0x1000;
3cf7f1314ed885 drivers/mtd/bcm47xxpart.c Rafał Miłecki 2012-08-30 107
3cf7f1314ed885 drivers/mtd/bcm47xxpart.c Rafał Miłecki 2012-08-30 108 /* Alloc */
6396bb221514d2 drivers/mtd/bcm47xxpart.c Kees Cook 2018-06-12 109 parts = kcalloc(BCM47XXPART_MAX_PARTS, sizeof(struct mtd_partition),
3cf7f1314ed885 drivers/mtd/bcm47xxpart.c Rafał Miłecki 2012-08-30 110 GFP_KERNEL);
99b1d1887fee36 drivers/mtd/bcm47xxpart.c Hauke Mehrtens 2013-10-13 111 if (!parts)
99b1d1887fee36 drivers/mtd/bcm47xxpart.c Hauke Mehrtens 2013-10-13 112 return -ENOMEM;
99b1d1887fee36 drivers/mtd/bcm47xxpart.c Hauke Mehrtens 2013-10-13 113
5ca1088f10d617 drivers/mtd/bcm47xxpart.c Rafał Miłecki 2013-03-07 114 buf = kzalloc(BCM47XXPART_BYTES_TO_READ, GFP_KERNEL);
99b1d1887fee36 drivers/mtd/bcm47xxpart.c Hauke Mehrtens 2013-10-13 115 if (!buf) {
99b1d1887fee36 drivers/mtd/bcm47xxpart.c Hauke Mehrtens 2013-10-13 116 kfree(parts);
99b1d1887fee36 drivers/mtd/bcm47xxpart.c Hauke Mehrtens 2013-10-13 117 return -ENOMEM;
99b1d1887fee36 drivers/mtd/bcm47xxpart.c Hauke Mehrtens 2013-10-13 118 }
3cf7f1314ed885 drivers/mtd/bcm47xxpart.c Rafał Miłecki 2012-08-30 119
3cf7f1314ed885 drivers/mtd/bcm47xxpart.c Rafał Miłecki 2012-08-30 120 /* Parse block by block looking for magics */
3cf7f1314ed885 drivers/mtd/bcm47xxpart.c Rafał Miłecki 2012-08-30 121 for (offset = 0; offset <= master->size - blocksize;
3cf7f1314ed885 drivers/mtd/bcm47xxpart.c Rafał Miłecki 2012-08-30 122 offset += blocksize) {
2a36a5c30eab9c drivers/mtd/bcm47xxpart.c Rafał Miłecki 2015-12-05 123 /* Nothing more in higher memory on BCM47XX (MIPS) */
97f2645f358b41 drivers/mtd/bcm47xxpart.c Masahiro Yamada 2016-08-03 124 if (IS_ENABLED(CONFIG_BCM47XX) && offset >= 0x2000000)
3cf7f1314ed885 drivers/mtd/bcm47xxpart.c Rafał Miłecki 2012-08-30 125 break;
3cf7f1314ed885 drivers/mtd/bcm47xxpart.c Rafał Miłecki 2012-08-30 126
00b79860eb5f72 drivers/mtd/bcm47xxpart.c Rafał Miłecki 2014-02-26 127 if (curr_part >= BCM47XXPART_MAX_PARTS) {
3cf7f1314ed885 drivers/mtd/bcm47xxpart.c Rafał Miłecki 2012-08-30 128 pr_warn("Reached maximum number of partitions, scanning stopped!\n");
3cf7f1314ed885 drivers/mtd/bcm47xxpart.c Rafał Miłecki 2012-08-30 129 break;
3cf7f1314ed885 drivers/mtd/bcm47xxpart.c Rafał Miłecki 2012-08-30 130 }
3cf7f1314ed885 drivers/mtd/bcm47xxpart.c Rafał Miłecki 2012-08-30 131
3cf7f1314ed885 drivers/mtd/bcm47xxpart.c Rafał Miłecki 2012-08-30 132 /* Read beginning of the block */
36bcc0c9c2bc8f drivers/mtd/bcm47xxpart.c Rafał Miłecki 2015-12-06 133 err = mtd_read(master, offset, BCM47XXPART_BYTES_TO_READ,
36bcc0c9c2bc8f drivers/mtd/bcm47xxpart.c Rafał Miłecki 2015-12-06 134 &bytes_read, (uint8_t *)buf);
36bcc0c9c2bc8f drivers/mtd/bcm47xxpart.c Rafał Miłecki 2015-12-06 135 if (err && !mtd_is_bitflip(err)) {
36bcc0c9c2bc8f drivers/mtd/bcm47xxpart.c Rafał Miłecki 2015-12-06 136 pr_err("mtd_read error while parsing (offset: 0x%X): %d\n",
36bcc0c9c2bc8f drivers/mtd/bcm47xxpart.c Rafał Miłecki 2015-12-06 137 offset, err);
3cf7f1314ed885 drivers/mtd/bcm47xxpart.c Rafał Miłecki 2012-08-30 138 continue;
3cf7f1314ed885 drivers/mtd/bcm47xxpart.c Rafał Miłecki 2012-08-30 139 }
3cf7f1314ed885 drivers/mtd/bcm47xxpart.c Rafał Miłecki 2012-08-30 140
4f8aaf72287578 drivers/mtd/bcm47xxpart.c Rafał Miłecki 2013-12-21 141 /* Magic or small NVRAM at 0x400 */
4f8aaf72287578 drivers/mtd/bcm47xxpart.c Rafał Miłecki 2013-12-21 142 if ((buf[0x4e0 / 4] == CFE_MAGIC && buf[0x4e4 / 4] == CFE_MAGIC) ||
4f8aaf72287578 drivers/mtd/bcm47xxpart.c Rafał Miłecki 2013-12-21 143 (buf[0x400 / 4] == NVRAM_HEADER)) {
3cf7f1314ed885 drivers/mtd/bcm47xxpart.c Rafał Miłecki 2012-08-30 144 bcm47xxpart_add_part(&parts[curr_part++], "boot",
3cf7f1314ed885 drivers/mtd/bcm47xxpart.c Rafał Miłecki 2012-08-30 145 offset, MTD_WRITEABLE);
3cf7f1314ed885 drivers/mtd/bcm47xxpart.c Rafał Miłecki 2012-08-30 146 continue;
3cf7f1314ed885 drivers/mtd/bcm47xxpart.c Rafał Miłecki 2012-08-30 147 }
3cf7f1314ed885 drivers/mtd/bcm47xxpart.c Rafał Miłecki 2012-08-30 148
3cf7f1314ed885 drivers/mtd/bcm47xxpart.c Rafał Miłecki 2012-08-30 149 /*
3cf7f1314ed885 drivers/mtd/bcm47xxpart.c Rafał Miłecki 2012-08-30 150 * board_data starts with board_id which differs across boards,
3cf7f1314ed885 drivers/mtd/bcm47xxpart.c Rafał Miłecki 2012-08-30 151 * but we can use 'MPFR' (hopefully) magic at 0x100
3cf7f1314ed885 drivers/mtd/bcm47xxpart.c Rafał Miłecki 2012-08-30 152 */
3cf7f1314ed885 drivers/mtd/bcm47xxpart.c Rafał Miłecki 2012-08-30 153 if (buf[0x100 / 4] == BOARD_DATA_MAGIC) {
3cf7f1314ed885 drivers/mtd/bcm47xxpart.c Rafał Miłecki 2012-08-30 154 bcm47xxpart_add_part(&parts[curr_part++], "board_data",
3cf7f1314ed885 drivers/mtd/bcm47xxpart.c Rafał Miłecki 2012-08-30 155 offset, MTD_WRITEABLE);
3cf7f1314ed885 drivers/mtd/bcm47xxpart.c Rafał Miłecki 2012-08-30 156 continue;
3cf7f1314ed885 drivers/mtd/bcm47xxpart.c Rafał Miłecki 2012-08-30 157 }
3cf7f1314ed885 drivers/mtd/bcm47xxpart.c Rafał Miłecki 2012-08-30 158
33094c736cd36a drivers/mtd/bcm47xxpart.c Rafał Miłecki 2013-10-21 159 /* Found on Huawei E970 */
33094c736cd36a drivers/mtd/bcm47xxpart.c Rafał Miłecki 2013-10-21 160 if (buf[0x000 / 4] == FACTORY_MAGIC) {
33094c736cd36a drivers/mtd/bcm47xxpart.c Rafał Miłecki 2013-10-21 161 bcm47xxpart_add_part(&parts[curr_part++], "factory",
33094c736cd36a drivers/mtd/bcm47xxpart.c Rafał Miłecki 2013-10-21 162 offset, MTD_WRITEABLE);
33094c736cd36a drivers/mtd/bcm47xxpart.c Rafał Miłecki 2013-10-21 163 continue;
33094c736cd36a drivers/mtd/bcm47xxpart.c Rafał Miłecki 2013-10-21 164 }
33094c736cd36a drivers/mtd/bcm47xxpart.c Rafał Miłecki 2013-10-21 165
3cf7f1314ed885 drivers/mtd/bcm47xxpart.c Rafał Miłecki 2012-08-30 166 /* POT(TOP) */
3cf7f1314ed885 drivers/mtd/bcm47xxpart.c Rafał Miłecki 2012-08-30 167 if (buf[0x000 / 4] == POT_MAGIC1 &&
3cf7f1314ed885 drivers/mtd/bcm47xxpart.c Rafał Miłecki 2012-08-30 168 (buf[0x004 / 4] & 0xFFFF) == POT_MAGIC2) {
3cf7f1314ed885 drivers/mtd/bcm47xxpart.c Rafał Miłecki 2012-08-30 169 bcm47xxpart_add_part(&parts[curr_part++], "POT", offset,
3cf7f1314ed885 drivers/mtd/bcm47xxpart.c Rafał Miłecki 2012-08-30 170 MTD_WRITEABLE);
3cf7f1314ed885 drivers/mtd/bcm47xxpart.c Rafał Miłecki 2012-08-30 171 continue;
3cf7f1314ed885 drivers/mtd/bcm47xxpart.c Rafał Miłecki 2012-08-30 172 }
3cf7f1314ed885 drivers/mtd/bcm47xxpart.c Rafał Miłecki 2012-08-30 173
3cf7f1314ed885 drivers/mtd/bcm47xxpart.c Rafał Miłecki 2012-08-30 174 /* ML */
3cf7f1314ed885 drivers/mtd/bcm47xxpart.c Rafał Miłecki 2012-08-30 175 if (buf[0x010 / 4] == ML_MAGIC1 &&
3cf7f1314ed885 drivers/mtd/bcm47xxpart.c Rafał Miłecki 2012-08-30 176 buf[0x014 / 4] == ML_MAGIC2) {
3cf7f1314ed885 drivers/mtd/bcm47xxpart.c Rafał Miłecki 2012-08-30 177 bcm47xxpart_add_part(&parts[curr_part++], "ML", offset,
3cf7f1314ed885 drivers/mtd/bcm47xxpart.c Rafał Miłecki 2012-08-30 178 MTD_WRITEABLE);
3cf7f1314ed885 drivers/mtd/bcm47xxpart.c Rafał Miłecki 2012-08-30 179 continue;
3cf7f1314ed885 drivers/mtd/bcm47xxpart.c Rafał Miłecki 2012-08-30 180 }
3cf7f1314ed885 drivers/mtd/bcm47xxpart.c Rafał Miłecki 2012-08-30 181
3cf7f1314ed885 drivers/mtd/bcm47xxpart.c Rafał Miłecki 2012-08-30 182 /* TRX */
3cf7f1314ed885 drivers/mtd/bcm47xxpart.c Rafał Miłecki 2012-08-30 183 if (buf[0x000 / 4] == TRX_MAGIC) {
b522d7b0ebe353 drivers/mtd/bcm47xxpart.c Rafał Miłecki 2017-01-10 184 struct trx_header *trx;
237ea0d4762cc1 drivers/mtd/bcm47xxpart.c Rafał Miłecki 2018-04-12 185 uint32_t last_subpart;
237ea0d4762cc1 drivers/mtd/bcm47xxpart.c Rafał Miłecki 2018-04-12 186 uint32_t trx_size;
3cf7f1314ed885 drivers/mtd/bcm47xxpart.c Rafał Miłecki 2012-08-30 187
89a0d9a9f1941a drivers/mtd/bcm47xxpart.c Rafał Miłecki 2017-01-10 188 if (trx_num >= ARRAY_SIZE(trx_parts))
89a0d9a9f1941a drivers/mtd/bcm47xxpart.c Rafał Miłecki 2017-01-10 189 pr_warn("No enough space to store another TRX found at 0x%X\n",
89a0d9a9f1941a drivers/mtd/bcm47xxpart.c Rafał Miłecki 2017-01-10 190 offset);
89a0d9a9f1941a drivers/mtd/bcm47xxpart.c Rafał Miłecki 2017-01-10 191 else
89a0d9a9f1941a drivers/mtd/bcm47xxpart.c Rafał Miłecki 2017-01-10 192 trx_parts[trx_num++] = curr_part;
396afe553bd607 drivers/mtd/bcm47xxpart.c Rafał Miłecki 2013-01-06 193 bcm47xxpart_add_part(&parts[curr_part++], "firmware",
396afe553bd607 drivers/mtd/bcm47xxpart.c Rafał Miłecki 2013-01-06 194 offset, 0);
396afe553bd607 drivers/mtd/bcm47xxpart.c Rafał Miłecki 2013-01-06 195
237ea0d4762cc1 drivers/mtd/bcm47xxpart.c Rafał Miłecki 2018-04-12 196 /*
237ea0d4762cc1 drivers/mtd/bcm47xxpart.c Rafał Miłecki 2018-04-12 197 * Try to find TRX size. The "length" field isn't fully
237ea0d4762cc1 drivers/mtd/bcm47xxpart.c Rafał Miłecki 2018-04-12 198 * reliable as it could be decreased to make CRC32 cover
237ea0d4762cc1 drivers/mtd/bcm47xxpart.c Rafał Miłecki 2018-04-12 199 * only part of TRX data. It's commonly used as checksum
237ea0d4762cc1 drivers/mtd/bcm47xxpart.c Rafał Miłecki 2018-04-12 200 * can't cover e.g. ever-changing rootfs partition.
237ea0d4762cc1 drivers/mtd/bcm47xxpart.c Rafał Miłecki 2018-04-12 201 * Use offsets as helpers for assuming min TRX size.
237ea0d4762cc1 drivers/mtd/bcm47xxpart.c Rafał Miłecki 2018-04-12 202 */
b522d7b0ebe353 drivers/mtd/bcm47xxpart.c Rafał Miłecki 2017-01-10 203 trx = (struct trx_header *)buf;
237ea0d4762cc1 drivers/mtd/bcm47xxpart.c Rafał Miłecki 2018-04-12 204 last_subpart = max3(trx->offset[0], trx->offset[1],
237ea0d4762cc1 drivers/mtd/bcm47xxpart.c Rafał Miłecki 2018-04-12 205 trx->offset[2]);
237ea0d4762cc1 drivers/mtd/bcm47xxpart.c Rafał Miłecki 2018-04-12 206 trx_size = max(trx->length, last_subpart + blocksize);
237ea0d4762cc1 drivers/mtd/bcm47xxpart.c Rafał Miłecki 2018-04-12 207
237ea0d4762cc1 drivers/mtd/bcm47xxpart.c Rafał Miłecki 2018-04-12 208 /*
237ea0d4762cc1 drivers/mtd/bcm47xxpart.c Rafał Miłecki 2018-04-12 209 * Skip the TRX data. Decrease offset by block size as
237ea0d4762cc1 drivers/mtd/bcm47xxpart.c Rafał Miłecki 2018-04-12 210 * the next loop iteration will increase it.
237ea0d4762cc1 drivers/mtd/bcm47xxpart.c Rafał Miłecki 2018-04-12 211 */
237ea0d4762cc1 drivers/mtd/bcm47xxpart.c Rafał Miłecki 2018-04-12 212 offset += roundup(trx_size, blocksize) - blocksize;
3cf7f1314ed885 drivers/mtd/bcm47xxpart.c Rafał Miłecki 2012-08-30 213 continue;
3cf7f1314ed885 drivers/mtd/bcm47xxpart.c Rafał Miłecki 2012-08-30 214 }
020c6bcfbeabee drivers/mtd/bcm47xxpart.c Rafał Miłecki 2013-10-21 215
020c6bcfbeabee drivers/mtd/bcm47xxpart.c Rafał Miłecki 2013-10-21 216 /* Squashfs on devices not using TRX */
0b56d2d45e7c27 drivers/mtd/bcm47xxpart.c Rafał Miłecki 2014-12-16 @217 if (le32_to_cpu(buf[0x000 / 4]) == SQUASHFS_MAGIC ||
0b56d2d45e7c27 drivers/mtd/bcm47xxpart.c Rafał Miłecki 2014-12-16 218 buf[0x000 / 4] == SHSQ_MAGIC) {
020c6bcfbeabee drivers/mtd/bcm47xxpart.c Rafał Miłecki 2013-10-21 219 bcm47xxpart_add_part(&parts[curr_part++], "rootfs",
020c6bcfbeabee drivers/mtd/bcm47xxpart.c Rafał Miłecki 2013-10-21 220 offset, 0);
020c6bcfbeabee drivers/mtd/bcm47xxpart.c Rafał Miłecki 2013-10-21 221 continue;
024629fdca1bbb drivers/mtd/bcm47xxpart.c Rafał Miłecki 2014-08-18 222 }
024629fdca1bbb drivers/mtd/bcm47xxpart.c Rafał Miłecki 2014-08-18 223
024629fdca1bbb drivers/mtd/bcm47xxpart.c Rafał Miłecki 2014-08-18 224 /*
024629fdca1bbb drivers/mtd/bcm47xxpart.c Rafał Miłecki 2014-08-18 225 * New (ARM?) devices may have NVRAM in some middle block. Last
024629fdca1bbb drivers/mtd/bcm47xxpart.c Rafał Miłecki 2014-08-18 226 * block will be checked later, so skip it.
024629fdca1bbb drivers/mtd/bcm47xxpart.c Rafał Miłecki 2014-08-18 227 */
024629fdca1bbb drivers/mtd/bcm47xxpart.c Rafał Miłecki 2014-08-18 228 if (offset != master->size - blocksize &&
024629fdca1bbb drivers/mtd/bcm47xxpart.c Rafał Miłecki 2014-08-18 229 buf[0x000 / 4] == NVRAM_HEADER) {
024629fdca1bbb drivers/mtd/bcm47xxpart.c Rafał Miłecki 2014-08-18 230 bcm47xxpart_add_part(&parts[curr_part++], "nvram",
024629fdca1bbb drivers/mtd/bcm47xxpart.c Rafał Miłecki 2014-08-18 231 offset, 0);
024629fdca1bbb drivers/mtd/bcm47xxpart.c Rafał Miłecki 2014-08-18 232 continue;
020c6bcfbeabee drivers/mtd/bcm47xxpart.c Rafał Miłecki 2013-10-21 233 }
f0501e81fbaa51 drivers/mtd/bcm47xxpart.c Rafał Miłecki 2013-12-21 234
f0501e81fbaa51 drivers/mtd/bcm47xxpart.c Rafał Miłecki 2013-12-21 235 /* Read middle of the block */
36bcc0c9c2bc8f drivers/mtd/bcm47xxpart.c Rafał Miłecki 2015-12-06 236 err = mtd_read(master, offset + 0x8000, 0x4, &bytes_read,
36bcc0c9c2bc8f drivers/mtd/bcm47xxpart.c Rafał Miłecki 2015-12-06 237 (uint8_t *)buf);
36bcc0c9c2bc8f drivers/mtd/bcm47xxpart.c Rafał Miłecki 2015-12-06 238 if (err && !mtd_is_bitflip(err)) {
36bcc0c9c2bc8f drivers/mtd/bcm47xxpart.c Rafał Miłecki 2015-12-06 239 pr_err("mtd_read error while parsing (offset: 0x%X): %d\n",
36bcc0c9c2bc8f drivers/mtd/bcm47xxpart.c Rafał Miłecki 2015-12-06 240 offset, err);
f0501e81fbaa51 drivers/mtd/bcm47xxpart.c Rafał Miłecki 2013-12-21 241 continue;
f0501e81fbaa51 drivers/mtd/bcm47xxpart.c Rafał Miłecki 2013-12-21 242 }
f0501e81fbaa51 drivers/mtd/bcm47xxpart.c Rafał Miłecki 2013-12-21 243
f0501e81fbaa51 drivers/mtd/bcm47xxpart.c Rafał Miłecki 2013-12-21 244 /* Some devices (ex. WNDR3700v3) don't have a standard 'MPFR' */
f0501e81fbaa51 drivers/mtd/bcm47xxpart.c Rafał Miłecki 2013-12-21 245 if (buf[0x000 / 4] == BOARD_DATA_MAGIC2) {
f0501e81fbaa51 drivers/mtd/bcm47xxpart.c Rafał Miłecki 2013-12-21 246 bcm47xxpart_add_part(&parts[curr_part++], "board_data",
f0501e81fbaa51 drivers/mtd/bcm47xxpart.c Rafał Miłecki 2013-12-21 247 offset, MTD_WRITEABLE);
f0501e81fbaa51 drivers/mtd/bcm47xxpart.c Rafał Miłecki 2013-12-21 248 continue;
f0501e81fbaa51 drivers/mtd/bcm47xxpart.c Rafał Miłecki 2013-12-21 249 }
3cf7f1314ed885 drivers/mtd/bcm47xxpart.c Rafał Miłecki 2012-08-30 250 }
91d542f4dcc231 drivers/mtd/bcm47xxpart.c Rafał Miłecki 2013-03-07 251
91d542f4dcc231 drivers/mtd/bcm47xxpart.c Rafał Miłecki 2013-03-07 252 /* Look for NVRAM at the end of the last block. */
91d542f4dcc231 drivers/mtd/bcm47xxpart.c Rafał Miłecki 2013-03-07 253 for (i = 0; i < ARRAY_SIZE(possible_nvram_sizes); i++) {
00b79860eb5f72 drivers/mtd/bcm47xxpart.c Rafał Miłecki 2014-02-26 254 if (curr_part >= BCM47XXPART_MAX_PARTS) {
91d542f4dcc231 drivers/mtd/bcm47xxpart.c Rafał Miłecki 2013-03-07 255 pr_warn("Reached maximum number of partitions, scanning stopped!\n");
91d542f4dcc231 drivers/mtd/bcm47xxpart.c Rafał Miłecki 2013-03-07 256 break;
91d542f4dcc231 drivers/mtd/bcm47xxpart.c Rafał Miłecki 2013-03-07 257 }
91d542f4dcc231 drivers/mtd/bcm47xxpart.c Rafał Miłecki 2013-03-07 258
91d542f4dcc231 drivers/mtd/bcm47xxpart.c Rafał Miłecki 2013-03-07 259 offset = master->size - possible_nvram_sizes[i];
36bcc0c9c2bc8f drivers/mtd/bcm47xxpart.c Rafał Miłecki 2015-12-06 260 err = mtd_read(master, offset, 0x4, &bytes_read,
36bcc0c9c2bc8f drivers/mtd/bcm47xxpart.c Rafał Miłecki 2015-12-06 261 (uint8_t *)buf);
36bcc0c9c2bc8f drivers/mtd/bcm47xxpart.c Rafał Miłecki 2015-12-06 262 if (err && !mtd_is_bitflip(err)) {
36bcc0c9c2bc8f drivers/mtd/bcm47xxpart.c Rafał Miłecki 2015-12-06 263 pr_err("mtd_read error while reading (offset 0x%X): %d\n",
36bcc0c9c2bc8f drivers/mtd/bcm47xxpart.c Rafał Miłecki 2015-12-06 264 offset, err);
91d542f4dcc231 drivers/mtd/bcm47xxpart.c Rafał Miłecki 2013-03-07 265 continue;
91d542f4dcc231 drivers/mtd/bcm47xxpart.c Rafał Miłecki 2013-03-07 266 }
91d542f4dcc231 drivers/mtd/bcm47xxpart.c Rafał Miłecki 2013-03-07 267
91d542f4dcc231 drivers/mtd/bcm47xxpart.c Rafał Miłecki 2013-03-07 268 /* Standard NVRAM */
91d542f4dcc231 drivers/mtd/bcm47xxpart.c Rafał Miłecki 2013-03-07 269 if (buf[0] == NVRAM_HEADER) {
91d542f4dcc231 drivers/mtd/bcm47xxpart.c Rafał Miłecki 2013-03-07 270 bcm47xxpart_add_part(&parts[curr_part++], "nvram",
91d542f4dcc231 drivers/mtd/bcm47xxpart.c Rafał Miłecki 2013-03-07 271 master->size - blocksize, 0);
91d542f4dcc231 drivers/mtd/bcm47xxpart.c Rafał Miłecki 2013-03-07 272 break;
91d542f4dcc231 drivers/mtd/bcm47xxpart.c Rafał Miłecki 2013-03-07 273 }
91d542f4dcc231 drivers/mtd/bcm47xxpart.c Rafał Miłecki 2013-03-07 274 }
91d542f4dcc231 drivers/mtd/bcm47xxpart.c Rafał Miłecki 2013-03-07 275
3cf7f1314ed885 drivers/mtd/bcm47xxpart.c Rafał Miłecki 2012-08-30 276 kfree(buf);
3cf7f1314ed885 drivers/mtd/bcm47xxpart.c Rafał Miłecki 2012-08-30 277
3cf7f1314ed885 drivers/mtd/bcm47xxpart.c Rafał Miłecki 2012-08-30 278 /*
3cf7f1314ed885 drivers/mtd/bcm47xxpart.c Rafał Miłecki 2012-08-30 279 * Assume that partitions end at the beginning of the one they are
3cf7f1314ed885 drivers/mtd/bcm47xxpart.c Rafał Miłecki 2012-08-30 280 * followed by.
3cf7f1314ed885 drivers/mtd/bcm47xxpart.c Rafał Miłecki 2012-08-30 281 */
648bdbee5d2cc3 drivers/mtd/bcm47xxpart.c Rafał Miłecki 2013-01-06 282 for (i = 0; i < curr_part; i++) {
648bdbee5d2cc3 drivers/mtd/bcm47xxpart.c Rafał Miłecki 2013-01-06 283 u64 next_part_offset = (i < curr_part - 1) ?
648bdbee5d2cc3 drivers/mtd/bcm47xxpart.c Rafał Miłecki 2013-01-06 284 parts[i + 1].offset : master->size;
648bdbee5d2cc3 drivers/mtd/bcm47xxpart.c Rafał Miłecki 2013-01-06 285
648bdbee5d2cc3 drivers/mtd/bcm47xxpart.c Rafał Miłecki 2013-01-06 286 parts[i].size = next_part_offset - parts[i].offset;
b522d7b0ebe353 drivers/mtd/bcm47xxpart.c Rafał Miłecki 2017-01-10 287 }
b522d7b0ebe353 drivers/mtd/bcm47xxpart.c Rafał Miłecki 2017-01-10 288
b522d7b0ebe353 drivers/mtd/bcm47xxpart.c Rafał Miłecki 2017-01-10 289 /* If there was TRX parse it now */
89a0d9a9f1941a drivers/mtd/bcm47xxpart.c Rafał Miłecki 2017-01-10 290 for (i = 0; i < trx_num; i++) {
89a0d9a9f1941a drivers/mtd/bcm47xxpart.c Rafał Miłecki 2017-01-10 291 struct mtd_partition *trx = &parts[trx_parts[i]];
89a0d9a9f1941a drivers/mtd/bcm47xxpart.c Rafał Miłecki 2017-01-10 292
99352afe8f169c drivers/mtd/bcm47xxpart.c Rafał Miłecki 2017-06-21 293 if (i == bcm47xxpart_bootpartition())
99352afe8f169c drivers/mtd/bcm47xxpart.c Rafał Miłecki 2017-06-21 294 trx->types = trx_types;
99352afe8f169c drivers/mtd/bcm47xxpart.c Rafał Miłecki 2017-06-21 295 else
89a0d9a9f1941a drivers/mtd/bcm47xxpart.c Rafał Miłecki 2017-01-10 296 trx->name = "failsafe";
89a0d9a9f1941a drivers/mtd/bcm47xxpart.c Rafał Miłecki 2017-01-10 297 }
3cf7f1314ed885 drivers/mtd/bcm47xxpart.c Rafał Miłecki 2012-08-30 298
3cf7f1314ed885 drivers/mtd/bcm47xxpart.c Rafał Miłecki 2012-08-30 299 *pparts = parts;
3cf7f1314ed885 drivers/mtd/bcm47xxpart.c Rafał Miłecki 2012-08-30 300 return curr_part;
3cf7f1314ed885 drivers/mtd/bcm47xxpart.c Rafał Miłecki 2012-08-30 301 };
3cf7f1314ed885 drivers/mtd/bcm47xxpart.c Rafał Miłecki 2012-08-30 302
:::::: The code at line 217 was first introduced by commit
:::::: 0b56d2d45e7c27581ca90f36b4317373f23e7622 mtd: bcm47xxpart: support SquashFS with an original magic
:::::: TO: Rafał Miłecki <zajec5@...il.com>
:::::: CC: Brian Norris <computersforpeace@...il.com>
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
Download attachment ".config.gz" of type "application/gzip" (24888 bytes)
Powered by blists - more mailing lists