mirror of
https://github.com/torvalds/linux.git
synced 2026-05-28 17:13:52 +02:00
mtd: rawnand: qcom: 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 <krzysztof.kozlowski@oss.qualcomm.com> Reviewed-by: Manivannan Sadhasivam <mani@kernel.org> Reviewed-by: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com> Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
This commit is contained in:
parent
c522c198aa
commit
42983837ef
|
|
@ -2206,16 +2206,14 @@ static int qcom_nand_host_init_and_register(struct qcom_nand_controller *nandc,
|
|||
static int qcom_probe_nand_devices(struct qcom_nand_controller *nandc)
|
||||
{
|
||||
struct device *dev = nandc->dev;
|
||||
struct device_node *dn = dev->of_node, *child;
|
||||
struct device_node *dn = dev->of_node;
|
||||
struct qcom_nand_host *host;
|
||||
int ret = -ENODEV;
|
||||
|
||||
for_each_available_child_of_node(dn, child) {
|
||||
for_each_available_child_of_node_scoped(dn, child) {
|
||||
host = devm_kzalloc(dev, sizeof(*host), GFP_KERNEL);
|
||||
if (!host) {
|
||||
of_node_put(child);
|
||||
if (!host)
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
ret = qcom_nand_host_init_and_register(nandc, host, child);
|
||||
if (ret) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user