mirror of
https://github.com/torvalds/linux.git
synced 2026-12-02 19:42:26 +00:00
mtd: spi-nor: hisi-sfc: Simplify with scoped for each OF child loop
Use scoped for-each loop when iterating over device nodes to make code a bit simpler. Signed-off-by: Krzysztof Kozlowski <[email protected]> Acked-by: Pratyush Yadav <[email protected]> Signed-off-by: Miquel Raynal <[email protected]>
This commit is contained in:
committed by
Miquel Raynal
parent
8f51b6be26
commit
aa8cb72c20
@@ -394,15 +394,12 @@ static void hisi_spi_nor_unregister_all(struct hifmc_host *host)
|
||||
static int hisi_spi_nor_register_all(struct hifmc_host *host)
|
||||
{
|
||||
struct device *dev = host->dev;
|
||||
struct device_node *np;
|
||||
int ret;
|
||||
|
||||
for_each_available_child_of_node(dev->of_node, np) {
|
||||
for_each_available_child_of_node_scoped(dev->of_node, np) {
|
||||
ret = hisi_spi_nor_register(np, host);
|
||||
if (ret) {
|
||||
of_node_put(np);
|
||||
if (ret)
|
||||
goto fail;
|
||||
}
|
||||
|
||||
if (host->num_chip == HIFMC_MAX_CHIP_NUM) {
|
||||
dev_warn(dev, "Flash device number exceeds the maximum chipselect number\n");
|
||||
|
||||
Reference in New Issue
Block a user