diff mbox series

hgafb: fix probe function

Message ID YKIuWEcIJvTIuE2j@mwanda (mailing list archive)
State New
Headers show
Series hgafb: fix probe function | expand

Commit Message

Dan Carpenter May 17, 2021, 8:50 a.m. UTC
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")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
 drivers/video/fbdev/hgafb.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Greg KH May 21, 2021, 12:54 p.m. UTC | #1
On Mon, May 17, 2021 at 11:50:32AM +0300, Dan Carpenter wrote:
> 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")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> ---
>  drivers/video/fbdev/hgafb.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/video/fbdev/hgafb.c b/drivers/video/fbdev/hgafb.c
> index cc8e62ae93f6..bd3d07aa4f0e 100644
> --- a/drivers/video/fbdev/hgafb.c
> +++ b/drivers/video/fbdev/hgafb.c
> @@ -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",
> -- 
> 2.30.2
> 

Someone _just_ beat you to this:
	https://lore.kernel.org/r/20210516192714.25823-1-mail@anirudhrb.com

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

thanks,

greg k-h
diff mbox series

Patch

diff --git a/drivers/video/fbdev/hgafb.c b/drivers/video/fbdev/hgafb.c
index cc8e62ae93f6..bd3d07aa4f0e 100644
--- a/drivers/video/fbdev/hgafb.c
+++ b/drivers/video/fbdev/hgafb.c
@@ -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",