[PATCH 04/10] net: emac: mal: replace of_get_property with of_property_read_u32

From: Rosen Penev

Date: Tue Jun 30 2026 - 00:17:48 EST


Replace the deprecated of_get_property() calls with the typed
of_property_read_u32() helper in mal_probe(). This is both safer
and more idiomatic for modern DT API usage.

Assisted-by: opencode:big-pickle
Signed-off-by: Rosen Penev <rosenp@xxxxxxxxx>
---
drivers/net/ethernet/ibm/emac/mal.c | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/drivers/net/ethernet/ibm/emac/mal.c b/drivers/net/ethernet/ibm/emac/mal.c
index 99615c8a6c3e..82d502d576ee 100644
--- a/drivers/net/ethernet/ibm/emac/mal.c
+++ b/drivers/net/ethernet/ibm/emac/mal.c
@@ -519,7 +519,7 @@ static int mal_probe(struct platform_device *ofdev)
int err = 0, i, bd_size;
int index = mal_count++;
unsigned int dcr_base;
- const u32 *prop;
+ u32 val;
u32 cfg;
unsigned long irqflags;
irq_handler_t hdlr_serr, hdlr_txde, hdlr_rxde;
@@ -535,23 +535,23 @@ static int mal_probe(struct platform_device *ofdev)

MAL_DBG(mal, "probe" NL);

- prop = of_get_property(ofdev->dev.of_node, "num-tx-chans", NULL);
- if (prop == NULL) {
+ err = of_property_read_u32(ofdev->dev.of_node, "num-tx-chans", &val);
+ if (err) {
printk(KERN_ERR
"mal%d: can't find MAL num-tx-chans property!\n",
index);
return -ENODEV;
}
- mal->num_tx_chans = prop[0];
+ mal->num_tx_chans = val;

- prop = of_get_property(ofdev->dev.of_node, "num-rx-chans", NULL);
- if (prop == NULL) {
+ err = of_property_read_u32(ofdev->dev.of_node, "num-rx-chans", &val);
+ if (err) {
printk(KERN_ERR
"mal%d: can't find MAL num-rx-chans property!\n",
index);
return -ENODEV;
}
- mal->num_rx_chans = prop[0];
+ mal->num_rx_chans = val;

dcr_base = dcr_resource_start(ofdev->dev.of_node, 0);
if (dcr_base == 0) {
--
2.54.0