Skip to content

Commit 7a21751

Browse files
Ethan TidmoreSasha Levin
authored andcommitted
drm/tiny: sharp-memory: fix pointer error dereference
[ Upstream commit 4612074 ] 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: b8f9f21 ("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>
1 parent 90f6a92 commit 7a21751

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

drivers/gpu/drm/tiny/sharp-memory.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -541,8 +541,8 @@ static int sharp_memory_probe(struct spi_device *spi)
541541

542542
smd = devm_drm_dev_alloc(dev, &sharp_memory_drm_driver,
543543
struct sharp_memory_device, drm);
544-
if (!smd)
545-
return -ENOMEM;
544+
if (IS_ERR(smd))
545+
return PTR_ERR(smd);
546546

547547
spi_set_drvdata(spi, smd);
548548

0 commit comments

Comments
 (0)