Re: [PATCH next] mux: mmio: Fix IS_ERR() vs NULL check in probe()
From: Krzysztof Kozlowski
Date: Sat Nov 29 2025 - 10:02:38 EST
On 29/11/2025 15:50, Dan Carpenter wrote:
> The devm_kmalloc() function never returns error pointers, it returns
> NULL on error. Fix the error checking.
>
> Fixes: 4863cb2b0f50 ("mux: mmio: Add suspend and resume support")
> Signed-off-by: Dan Carpenter <dan.carpenter@xxxxxxxxxx>
> ---
> drivers/mux/mmio.c | 8 ++++----
> 1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/mux/mmio.c b/drivers/mux/mmio.c
> index e4ddb1e61923..3409af1ffb80 100644
> --- a/drivers/mux/mmio.c
> +++ b/drivers/mux/mmio.c
> @@ -101,13 +101,13 @@ 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);
> - if (IS_ERR(mux_mmio->fields))
> - return PTR_ERR(mux_mmio->fields);
> + if (!mux_mmio->fields)
> + return -ENOMEM;
>
I wonder from where Thomas copied this code...
Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@xxxxxxxxxxxxxxxx>
@Greg, that's a fix for something in your tree.
Best regards,
Krzysztof