summaryrefslogtreecommitdiff
path: root/drivers/gpu/drm/tiny/sharp-memory.c
diff options
context:
space:
mode:
authorEthan Tidmore <ethantidmore06@gmail.com>2026-02-16 07:04:38 +0300
committerSasha Levin <sashal@kernel.org>2026-03-12 14:09:07 +0300
commit7a21751770dd1b5a531a3557e09d01f333fa159d (patch)
tree19140ef94e5e21df3741e814139bc3a4ee22614d /drivers/gpu/drm/tiny/sharp-memory.c
parent90f6a92d7469be9c5cb8690cc30fa5d7a3816f66 (diff)
downloadlinux-7a21751770dd1b5a531a3557e09d01f333fa159d.tar.xz
drm/tiny: sharp-memory: fix pointer error dereference
[ Upstream commit 46120745bb4e7e1f09959624716b4c5d6e2c2e9e ] The function devm_drm_dev_alloc() returns a pointer error upon failure not NULL. Change null check to pointer error check. Detected by Smatch: drivers/gpu/drm/tiny/sharp-memory.c:549 sharp_memory_probe() error: 'smd' dereferencing possible ERR_PTR() Fixes: b8f9f21716fec ("drm/tiny: Add driver for Sharp Memory LCD") Signed-off-by: Ethan Tidmore <ethantidmore06@gmail.com> Reviewed-by: Thomas Zimmermann <tzimmermann@suse.de> Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de> Link: https://patch.msgid.link/20260216040438.43702-1-ethantidmore06@gmail.com Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'drivers/gpu/drm/tiny/sharp-memory.c')
-rw-r--r--drivers/gpu/drm/tiny/sharp-memory.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/gpu/drm/tiny/sharp-memory.c b/drivers/gpu/drm/tiny/sharp-memory.c
index 64272cd0f6e2..cbf69460ebf3 100644
--- a/drivers/gpu/drm/tiny/sharp-memory.c
+++ b/drivers/gpu/drm/tiny/sharp-memory.c
@@ -541,8 +541,8 @@ static int sharp_memory_probe(struct spi_device *spi)
smd = devm_drm_dev_alloc(dev, &sharp_memory_drm_driver,
struct sharp_memory_device, drm);
- if (!smd)
- return -ENOMEM;
+ if (IS_ERR(smd))
+ return PTR_ERR(smd);
spi_set_drvdata(spi, smd);