forked from mirrors/linux
		
	misc: sram: Generate unique names for subpools
The current code will, if we do not specify unique labels
for the SRAM subnodes, fail to register several nodes named
the same.
Example:
sram@40020000 {
  (...)
  sram@0 {
    (...)
  };
  sram@1000 {
    (...)
  };
};
Since the child->name in both cases will be "sram" the
gen_pool_create() will fail because the name is not unique.
Use dev_name() for the device as this will have bus ID
set to the fully translated address for the node, and that
will always be unique.
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Link: https://lore.kernel.org/r/20230417-ux500-sram-v2-2-6e62ad551faa@linaro.org
			
			
This commit is contained in:
		
							parent
							
								
									38bd22dac7
								
							
						
					
					
						commit
						21e5a2d10c
					
				
					 1 changed files with 5 additions and 4 deletions
				
			
		| 
						 | 
					@ -235,8 +235,9 @@ static int sram_reserve_regions(struct sram_dev *sram, struct resource *res)
 | 
				
			||||||
				goto err_chunks;
 | 
									goto err_chunks;
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
			if (!label)
 | 
								if (!label)
 | 
				
			||||||
				label = child->name;
 | 
									block->label = devm_kasprintf(sram->dev, GFP_KERNEL,
 | 
				
			||||||
 | 
												      "%s", dev_name(sram->dev));
 | 
				
			||||||
 | 
								else
 | 
				
			||||||
				block->label = devm_kstrdup(sram->dev,
 | 
									block->label = devm_kstrdup(sram->dev,
 | 
				
			||||||
							    label, GFP_KERNEL);
 | 
												    label, GFP_KERNEL);
 | 
				
			||||||
			if (!block->label) {
 | 
								if (!block->label) {
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in a new issue