Skip to contentSkip to conversation

hgafb: fix probe function

PATCH In review Dan Carpenter 2 participants 2 messages May 17, 2021 – May 21, 2021

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 hgafb: fix probe function

There is a reversed if statement in this probe function so the driver is completely broken.

Fixes dc13cac4862c ("video: hgafb: fix potential NULL pointer dereference")
---
 drivers/video/fbdev/hgafb.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/video/fbdev/hgafb.c +1 -1
index cc8e62ae93f6..bd3d07aa4f0e 100644
@@ -558,7 +558,7 @@ static int hgafb_probe(struct platform_device *pdev)
 	int ret;
 
 	ret = hga_card_detect();
-	if (!ret)
+	if (ret)
 		return ret;
 
 	printk(KERN_INFO "hgafb: %s with %ldK of memory detected.\n",
Signature · 1 line
2.30.2
#1 lore raw
Quoted 25 lines · Dan Carpenter

There is a reversed if statement in this probe function so the driver is completely broken.

Fixes dc13cac4862c ("video: hgafb: fix potential NULL pointer dereference")
---
 drivers/video/fbdev/hgafb.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/video/fbdev/hgafb.c +1 -1
index cc8e62ae93f6..bd3d07aa4f0e 100644
@@ -558,7 +558,7 @@ static int hgafb_probe(struct platform_device *pdev)
 	int ret;
 
 	ret = hga_card_detect();
-	if (!ret)
+	if (ret)
 		return ret;
 
 	printk(KERN_INFO "hgafb: %s with %ldK of memory detected.\n",
Signature · 1 line
2.30.2

Someone _just_ beat you to this:

	https://lore.kernel.org/r/[email protected]

I'll add your s-o-b to that one as it's identical to yours.

thanks,

greg k-h