Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

soc: fsl: qe: 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>
Acked-by: Herve Codina <herve.codina@bootlin.com>
Link: https://lore.kernel.org/r/20260102124754.64122-2-krzysztof.kozlowski@oss.qualcomm.com
Signed-off-by: Christophe Leroy (CS GROUP) <chleroy@kernel.org>

authored by

Krzysztof Kozlowski and committed by
Christophe Leroy (CS GROUP)
66a4ff38 148891e9

+2 -11
+2 -11
drivers/soc/fsl/qe/qmc.c
··· 1284 1284 1285 1285 static int qmc_of_parse_chans(struct qmc *qmc, struct device_node *np) 1286 1286 { 1287 - struct device_node *chan_np; 1288 1287 struct qmc_chan *chan; 1289 1288 const char *mode; 1290 1289 u32 chan_id; 1291 1290 u64 ts_mask; 1292 1291 int ret; 1293 1292 1294 - for_each_available_child_of_node(np, chan_np) { 1293 + for_each_available_child_of_node_scoped(np, chan_np) { 1295 1294 ret = of_property_read_u32(chan_np, "reg", &chan_id); 1296 1295 if (ret) { 1297 1296 dev_err(qmc->dev, "%pOF: failed to read reg\n", chan_np); 1298 - of_node_put(chan_np); 1299 1297 return ret; 1300 1298 } 1301 1299 if (chan_id > 63) { 1302 1300 dev_err(qmc->dev, "%pOF: Invalid chan_id\n", chan_np); 1303 - of_node_put(chan_np); 1304 1301 return -EINVAL; 1305 1302 } 1306 1303 1307 1304 chan = devm_kzalloc(qmc->dev, sizeof(*chan), GFP_KERNEL); 1308 - if (!chan) { 1309 - of_node_put(chan_np); 1305 + if (!chan) 1310 1306 return -ENOMEM; 1311 - } 1312 1307 1313 1308 chan->id = chan_id; 1314 1309 spin_lock_init(&chan->ts_lock); ··· 1314 1319 if (ret) { 1315 1320 dev_err(qmc->dev, "%pOF: failed to read fsl,tx-ts-mask\n", 1316 1321 chan_np); 1317 - of_node_put(chan_np); 1318 1322 return ret; 1319 1323 } 1320 1324 chan->tx_ts_mask_avail = ts_mask; ··· 1323 1329 if (ret) { 1324 1330 dev_err(qmc->dev, "%pOF: failed to read fsl,rx-ts-mask\n", 1325 1331 chan_np); 1326 - of_node_put(chan_np); 1327 1332 return ret; 1328 1333 } 1329 1334 chan->rx_ts_mask_avail = ts_mask; ··· 1333 1340 if (ret && ret != -EINVAL) { 1334 1341 dev_err(qmc->dev, "%pOF: failed to read fsl,operational-mode\n", 1335 1342 chan_np); 1336 - of_node_put(chan_np); 1337 1343 return ret; 1338 1344 } 1339 1345 if (!strcmp(mode, "transparent")) { ··· 1342 1350 } else { 1343 1351 dev_err(qmc->dev, "%pOF: Invalid fsl,operational-mode (%s)\n", 1344 1352 chan_np, mode); 1345 - of_node_put(chan_np); 1346 1353 return -EINVAL; 1347 1354 } 1348 1355