Skip to contentSkip to conversation

linux-next: manual merge of the l2-mtd tree with the mtd tree

DISCUSSION Stephen Rothwell 1 participant 1 message Jan 5, 2016 Linux-next tree

lore
Share & tools
lore
#0 lore raw

Hi Brian,

Today's linux-next merge of the l2-mtd tree got a conflict in:

drivers/mtd/mtdcore.c

between commit:

472b444eef93 ("mtd: fix cmdlinepart parser, early naming for auto-filled MTD")

from the mtd tree and commit:

07fd2f871c5e ("mtd: partitions: pass around 'mtd_partitions' wrapper struct")

from the l2-mtd tree.

I fixed it up (see below) and can carry the fix as necessary (no action is required).

Signature · 42 lines
Cheers,
Stephen Rothwell                    [email protected]

diff --cc drivers/mtd/mtdcore.c
index ffa288474820,89d811e7b04a..000000000000
--- a/drivers/mtd/mtdcore.c
+++ b/drivers/mtd/mtdcore.c
@@@ -590,22 -589,20 +595,22 @@@ int mtd_device_parse_register(struct mt
  			      const struct mtd_partition *parts,
  			      int nr_parts)
  {
+ 	struct mtd_partitions parsed;
  	int ret;
- 	struct mtd_partition *real_parts = NULL;
  
 +	mtd_set_dev_defaults(mtd);
 +
- 	ret = parse_mtd_partitions(mtd, types, &real_parts, parser_data);
- 	if (ret <= 0 && nr_parts && parts) {
- 		real_parts = kmemdup(parts, sizeof(*parts) * nr_parts,
- 				     GFP_KERNEL);
- 		if (!real_parts)
- 			ret = -ENOMEM;
- 		else
- 			ret = nr_parts;
- 	}
- 	/* Didn't come up with either parsed OR fallback partitions */
- 	if (ret < 0) {
+ 	memset(&parsed, 0, sizeof(parsed));
+ 
+ 	ret = parse_mtd_partitions(mtd, types, &parsed, parser_data);
+ 	if ((ret < 0 || parsed.nr_parts == 0) && parts && nr_parts) {
+ 		/* Fall back to driver-provided partitions */
+ 		parsed = (struct mtd_partitions){
+ 			.parts		= parts,
+ 			.nr_parts	= nr_parts,
+ 		};
+ 	} else if (ret < 0) {
+ 		/* Didn't come up with parsed OR fallback partitions */
  		pr_info("mtd: failed to find partitions; one or more parsers reports errors (%d)\n",
  			ret);
  		/* Don't abort on errors; we can still use unpartitioned MTD */