Linux Framebuffer Layer development
 help / color / mirror / Atom feed
From: Thomas Zimmermann <tzimmermann@suse.de>
To: Dan Carpenter <error27@gmail.com>
Cc: Javier Martinez Canillas <javierm@redhat.com>,
	Yang Yingliang <yangyingliang@huawei.com>,
	linux-fbdev@vger.kernel.org, dri-devel@lists.freedesktop.org,
	kernel-janitors@vger.kernel.org
Subject: Re: [PATCH] fbdev: chipsfb: Fix error codes in chipsfb_pci_init()
Date: Mon, 27 Feb 2023 11:13:19 +0100	[thread overview]
Message-ID: <2673f515-9516-de13-3e59-4d473165010d@suse.de> (raw)
In-Reply-To: <Y/yA53V/rW8g1Zlm@kili>


[-- Attachment #1.1: Type: text/plain, Size: 2005 bytes --]

Hi

Am 27.02.23 um 11:07 schrieb Dan Carpenter:
> The error codes are not set on these error paths.
> 
> Fixes: 145eed48de27 ("fbdev: Remove conflicting devices on PCI bus")
> Signed-off-by: Dan Carpenter <error27@gmail.com>

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

with the comments below addressed.

> ---
>   drivers/video/fbdev/chipsfb.c | 14 ++++++++++----
>   1 file changed, 10 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/video/fbdev/chipsfb.c b/drivers/video/fbdev/chipsfb.c
> index cc37ec3f8fc1..98398789528a 100644
> --- a/drivers/video/fbdev/chipsfb.c
> +++ b/drivers/video/fbdev/chipsfb.c
> @@ -358,16 +358,21 @@ static int chipsfb_pci_init(struct pci_dev *dp, const struct pci_device_id *ent)
>   	if (rc)
>   		return rc;
>   
> -	if (pci_enable_device(dp) < 0) {
> +	rc = pci_enable_device(dp);
> +	if (rc < 0) {
>   		dev_err(&dp->dev, "Cannot enable PCI device\n");
>   		goto err_out;
>   	}
>   
> -	if ((dp->resource[0].flags & IORESOURCE_MEM) == 0)
> +	if ((dp->resource[0].flags & IORESOURCE_MEM) == 0) {
> +		rc = -EINVAL;

I think ENODEV is more appropriate. And it's the default value from the 
original code.

>   		goto err_disable;
> +	}
>   	addr = pci_resource_start(dp, 0);
> -	if (addr == 0)
> +	if (addr == 0) {
> +		rc = -EINVAL;

Same here.

Best regards
Thomas

>   		goto err_disable;
> +	}
>   
>   	p = framebuffer_alloc(0, &dp->dev);
>   	if (p == NULL) {
> @@ -417,7 +422,8 @@ static int chipsfb_pci_init(struct pci_dev *dp, const struct pci_device_id *ent)
>   
>   	init_chips(p, addr);
>   
> -	if (register_framebuffer(p) < 0) {
> +	rc = register_framebuffer(p);
> +	if (rc < 0) {
>   		dev_err(&dp->dev,"C&T 65550 framebuffer failed to register\n");
>   		goto err_unmap;
>   	}

-- 
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Maxfeldstr. 5, 90409 Nürnberg, Germany
(HRB 36809, AG Nürnberg)
Geschäftsführer: Ivo Totev

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 840 bytes --]

  reply	other threads:[~2023-02-27 10:13 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-27 10:07 [PATCH] fbdev: chipsfb: Fix error codes in chipsfb_pci_init() Dan Carpenter
2023-02-27 10:13 ` Thomas Zimmermann [this message]
2023-02-27 10:27   ` Dan Carpenter

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=2673f515-9516-de13-3e59-4d473165010d@suse.de \
    --to=tzimmermann@suse.de \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=error27@gmail.com \
    --cc=javierm@redhat.com \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-fbdev@vger.kernel.org \
    --cc=yangyingliang@huawei.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox