From: Dan Carpenter <dan.carpenter@linaro.org>
To: Marcus Folkesson <marcus.folkesson@gmail.com>
Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>,
Maxime Ripard <mripard@kernel.org>,
Thomas Zimmermann <tzimmermann@suse.de>,
David Airlie <airlied@gmail.com>, Simona Vetter <simona@ffwll.ch>,
Javier Martinez Canillas <javierm@redhat.com>,
dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org,
kernel-janitors@vger.kernel.org
Subject: [PATCH next] drm/st7571-i2c: Fix IS_ERR() vs NULL checks in probe()
Date: Wed, 30 Apr 2025 11:03:46 +0300 [thread overview]
Message-ID: <aBHZYgPPPYY-J8Vd@stanley.mountain> (raw)
The devm_kzalloc() function returns NULL on failure, not error pointers.
Also printing an error message for kmalloc() failures is against kernel
style so just return -ENOMEM without printing a message. (Kmalloc
already prints a message).
Fixes: 4b35f0f41ee2 ("drm/st7571-i2c: add support for Sitronix ST7571 LCD controller")
Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
---
drivers/gpu/drm/tiny/st7571-i2c.c | 10 ++++------
1 file changed, 4 insertions(+), 6 deletions(-)
diff --git a/drivers/gpu/drm/tiny/st7571-i2c.c b/drivers/gpu/drm/tiny/st7571-i2c.c
index dc410ec41baf..eec846892962 100644
--- a/drivers/gpu/drm/tiny/st7571-i2c.c
+++ b/drivers/gpu/drm/tiny/st7571-i2c.c
@@ -908,16 +908,14 @@ static int st7571_probe(struct i2c_client *client)
st7571->hwbuf = devm_kzalloc(&client->dev,
(st7571->nlines * st7571->ncols * st7571->bpp) / 8,
GFP_KERNEL);
- if (IS_ERR(st7571->hwbuf))
- return dev_err_probe(&client->dev, PTR_ERR(st7571->hwbuf),
- "Failed to allocate intermediate buffer\n");
+ if (!st7571->hwbuf)
+ return -ENOMEM;
st7571->row = devm_kzalloc(&client->dev,
(st7571->ncols * st7571->bpp),
GFP_KERNEL);
- if (IS_ERR(st7571->row))
- return dev_err_probe(&client->dev, PTR_ERR(st7571->row),
- "Failed to allocate row buffer\n");
+ if (!st7571->row)
+ return -ENOMEM;
ret = st7571_mode_config_init(st7571);
if (ret)
--
2.47.2
next reply other threads:[~2025-04-30 8:03 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-04-30 8:03 Dan Carpenter [this message]
2025-04-30 12:47 ` [PATCH next] drm/st7571-i2c: Fix IS_ERR() vs NULL checks in probe() Javier Martinez Canillas
2025-04-30 13:00 ` Javier Martinez Canillas
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=aBHZYgPPPYY-J8Vd@stanley.mountain \
--to=dan.carpenter@linaro.org \
--cc=airlied@gmail.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=javierm@redhat.com \
--cc=kernel-janitors@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=maarten.lankhorst@linux.intel.com \
--cc=marcus.folkesson@gmail.com \
--cc=mripard@kernel.org \
--cc=simona@ffwll.ch \
--cc=tzimmermann@suse.de \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.