[RESEND PATCH] mux: mmio: Zero the allocated memory

From: Krzysztof Kozlowski

Date: Sun Mar 01 2026 - 09:18:10 EST


Zero the allocated memory in probe() for fields and states for increased
code safety and to match expected Linux coding style.

Cc: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>
Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@xxxxxxxxxxxxxxxx>

---

Resend after two months
---
drivers/mux/mmio.c | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/drivers/mux/mmio.c b/drivers/mux/mmio.c
index 0611ef28bb69..b61e590f2ac9 100644
--- a/drivers/mux/mmio.c
+++ b/drivers/mux/mmio.c
@@ -100,12 +100,14 @@ static int mux_mmio_probe(struct platform_device *pdev)

mux_mmio = mux_chip_priv(mux_chip);

- mux_mmio->fields = devm_kmalloc(dev, num_fields * sizeof(*mux_mmio->fields), GFP_KERNEL);
+ mux_mmio->fields = devm_kcalloc(dev, num_fields, sizeof(*mux_mmio->fields),
+ GFP_KERNEL);
if (!mux_mmio->fields)
return -ENOMEM;

- mux_mmio->hardware_states = devm_kmalloc(dev, num_fields *
- sizeof(*mux_mmio->hardware_states), GFP_KERNEL);
+ mux_mmio->hardware_states = devm_kcalloc(dev, num_fields,
+ sizeof(*mux_mmio->hardware_states),
+ GFP_KERNEL);
if (!mux_mmio->hardware_states)
return -ENOMEM;

--
2.51.0