linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH -next] drm/vmwgfx: Fix return value check in vmw_setup_pci_resources()
@ 2021-05-14  8:28 Qiheng Lin
  2021-05-14 18:33 ` Zack Rusin
  0 siblings, 1 reply; 2+ messages in thread
From: Qiheng Lin @ 2021-05-14  8:28 UTC (permalink / raw)
  To: linqiheng, VMware Graphics, Roland Scheidegger, Zack Rusin,
	David Airlie, Daniel Vetter
  Cc: dri-devel, linux-kernel, kernel-janitors, Hulk Robot

In case of error, the function devm_ioremap() returns NULL pointer not ERR_PTR().
The IS_ERR() test in the return value check should be replaced with NULL test.
After that, the error code -ENOMEM should be returned.

Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Qiheng Lin <linqiheng@huawei.com>
---
 drivers/gpu/drm/vmwgfx/vmwgfx_drv.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c b/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c
index 5cf3a5bf539f..6f5ea00973e0 100644
--- a/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c
@@ -719,10 +719,10 @@ static int vmw_setup_pci_resources(struct vmw_private *dev,
 		dev->rmmio = devm_ioremap(dev->drm.dev,
 					  rmmio_start,
 					  rmmio_size);
-		if (IS_ERR(dev->rmmio)) {
+		if (!dev->rmmio) {
 			DRM_ERROR("Failed mapping registers mmio memory.\n");
 			pci_release_regions(pdev);
-			return PTR_ERR(dev->rmmio);
+			return -ENOMEM;
 		}
 	} else if (pci_id == VMWGFX_PCI_ID_SVGA2) {
 		dev->io_start = pci_resource_start(pdev, 0);


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH -next] drm/vmwgfx: Fix return value check in vmw_setup_pci_resources()
  2021-05-14  8:28 [PATCH -next] drm/vmwgfx: Fix return value check in vmw_setup_pci_resources() Qiheng Lin
@ 2021-05-14 18:33 ` Zack Rusin
  0 siblings, 0 replies; 2+ messages in thread
From: Zack Rusin @ 2021-05-14 18:33 UTC (permalink / raw)
  To: Qiheng Lin, VMware Graphics, Roland Scheidegger, David Airlie,
	Daniel Vetter
  Cc: dri-devel, linux-kernel, kernel-janitors, Hulk Robot

On 5/14/21 4:28 AM, Qiheng Lin wrote:
> In case of error, the function devm_ioremap() returns NULL pointer not ERR_PTR().
> The IS_ERR() test in the return value check should be replaced with NULL test.
> After that, the error code -ENOMEM should be returned.
> 
> Reported-by: Hulk Robot <hulkci@huawei.com>
> Signed-off-by: Qiheng Lin <linqiheng@huawei.com>

Looks good. Thank you. I'll push it with some other fixes via drm-misc-next.

z

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-05-14 18:33 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-14  8:28 [PATCH -next] drm/vmwgfx: Fix return value check in vmw_setup_pci_resources() Qiheng Lin
2021-05-14 18:33 ` Zack Rusin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).