* [PATCH next] mux: mmio: Fix IS_ERR() vs NULL check in probe()
@ 2025-11-29 14:50 Dan Carpenter
2025-11-29 15:02 ` Krzysztof Kozlowski
0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2025-11-29 14:50 UTC (permalink / raw)
To: Thomas Richard
Cc: Peter Rosin, Krzysztof Kozlowski, Andrew Davis, Thorsten Blum,
Greg Kroah-Hartman, linux-kernel, kernel-janitors
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@linaro.org>
---
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;
mux_mmio->hardware_states = devm_kmalloc(dev, num_fields *
sizeof(*mux_mmio->hardware_states), GFP_KERNEL);
- if (IS_ERR(mux_mmio->hardware_states))
- return PTR_ERR(mux_mmio->hardware_states);
+ if (!mux_mmio->hardware_states)
+ return -ENOMEM;
for (i = 0; i < num_fields; i++) {
struct mux_control *mux = &mux_chip->mux[i];
--
2.51.0
^ permalink raw reply related [flat|nested] 2+ messages in thread* Re: [PATCH next] mux: mmio: Fix IS_ERR() vs NULL check in probe()
2025-11-29 14:50 [PATCH next] mux: mmio: Fix IS_ERR() vs NULL check in probe() Dan Carpenter
@ 2025-11-29 15:02 ` Krzysztof Kozlowski
0 siblings, 0 replies; 2+ messages in thread
From: Krzysztof Kozlowski @ 2025-11-29 15:02 UTC (permalink / raw)
To: Dan Carpenter, Greg Kroah-Hartman
Cc: Peter Rosin, Andrew Davis, Thorsten Blum, linux-kernel,
kernel-janitors, Thomas Richard
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@linaro.org>
> ---
> 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@oss.qualcomm.com>
@Greg, that's a fix for something in your tree.
Best regards,
Krzysztof
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2025-11-29 15:02 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-11-29 14:50 [PATCH next] mux: mmio: Fix IS_ERR() vs NULL check in probe() Dan Carpenter
2025-11-29 15:02 ` Krzysztof Kozlowski
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox