From: Alper Ak <alperyasinak1@gmail.com>
To: peda@axentia.se
Cc: Alper Ak <alperyasinak1@gmail.com>,
Krzysztof Kozlowski <krzysztof.kozlowski@oss.qualcomm.com>,
Andrew Davis <afd@ti.com>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
"Thomas Richard (TI.com)" <thomas.richard@bootlin.com>,
Thorsten Blum <thorsten.blum@linux.dev>,
linux-kernel@vger.kernel.org
Subject: [PATCH v2] mux: mmio: fix IS_ERR() vs NULL check for mux_mmio_probe()
Date: Thu, 25 Dec 2025 15:48:26 +0300 [thread overview]
Message-ID: <20251225124828.346114-1-alperyasinak1@gmail.com> (raw)
In-Reply-To: <5e5d1d25-2e03-43fa-bbc6-8256f31a1000@kernel.org>
devm_kmalloc() returns NULL on failure, not an ERR_PTR value. The
current IS_ERR() check will never catch allocation failures, which
could lead to NULL pointer dereference.
Fixes: 4863cb2b0f50 ("mux: mmio: Add suspend and resume support")
Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@oss.qualcomm.com>
Signed-off-by: Alper Ak <alperyasinak1@gmail.com>
---
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.43.0
prev parent reply other threads:[~2025-12-25 12:49 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-12-25 11:41 [PATCH] mmux: " Alper Ak
2025-12-25 12:08 ` Krzysztof Kozlowski
2025-12-25 12:48 ` Alper Ak [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20251225124828.346114-1-alperyasinak1@gmail.com \
--to=alperyasinak1@gmail.com \
--cc=afd@ti.com \
--cc=gregkh@linuxfoundation.org \
--cc=krzysztof.kozlowski@oss.qualcomm.com \
--cc=linux-kernel@vger.kernel.org \
--cc=peda@axentia.se \
--cc=thomas.richard@bootlin.com \
--cc=thorsten.blum@linux.dev \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®