firmware/sysfb: fix an error code in sysfb_init()

Message ID aaaa2e13-849b-41a0-8186-25f3d2a16f86@moroto.mountain
State New
Headers
Series firmware/sysfb: fix an error code in sysfb_init() |

Commit Message

Dan Carpenter Feb. 22, 2024, 6:13 a.m. UTC
  This error path accidentally returns success when it should preserve the
error code from sysfb_parent_dev().

Fixes: 4e754597d603 ("firmware/sysfb: Create firmware device only for enabled PCI devices")
Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
---
 drivers/firmware/sysfb.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
  

Comments

Thomas Zimmermann Feb. 22, 2024, 8:10 a.m. UTC | #1
Am 22.02.24 um 07:13 schrieb Dan Carpenter:
> This error path accidentally returns success when it should preserve the
> error code from sysfb_parent_dev().

Thanks! I'll land the patch via drm-misc.

>
> Fixes: 4e754597d603 ("firmware/sysfb: Create firmware device only for enabled PCI devices")
> Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>

Reviewed-by: Thomas Zimmermann <tzimmermann@suse.de>

> ---
>   drivers/firmware/sysfb.c | 4 +++-
>   1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/firmware/sysfb.c b/drivers/firmware/sysfb.c
> index a6b48703dc9e..880ffcb50088 100644
> --- a/drivers/firmware/sysfb.c
> +++ b/drivers/firmware/sysfb.c
> @@ -127,8 +127,10 @@ static __init int sysfb_init(void)
>   	sysfb_apply_efi_quirks();
>   
>   	parent = sysfb_parent_dev(si);
> -	if (IS_ERR(parent))
> +	if (IS_ERR(parent)) {
> +		ret = PTR_ERR(parent);
>   		goto unlock_mutex;
> +	}
>   
>   	/* try to create a simple-framebuffer device */
>   	compatible = sysfb_parse_mode(si, &mode);
  

Patch

diff --git a/drivers/firmware/sysfb.c b/drivers/firmware/sysfb.c
index a6b48703dc9e..880ffcb50088 100644
--- a/drivers/firmware/sysfb.c
+++ b/drivers/firmware/sysfb.c
@@ -127,8 +127,10 @@  static __init int sysfb_init(void)
 	sysfb_apply_efi_quirks();
 
 	parent = sysfb_parent_dev(si);
-	if (IS_ERR(parent))
+	if (IS_ERR(parent)) {
+		ret = PTR_ERR(parent);
 		goto unlock_mutex;
+	}
 
 	/* try to create a simple-framebuffer device */
 	compatible = sysfb_parse_mode(si, &mode);