* [PATCH] fbdev: chipsfb: Fix error codes in chipsfb_pci_init()
@ 2023-02-27 10:07 Dan Carpenter
2023-02-27 10:13 ` Thomas Zimmermann
0 siblings, 1 reply; 3+ messages in thread
From: Dan Carpenter @ 2023-02-27 10:07 UTC (permalink / raw)
To: Thomas Zimmermann
Cc: Javier Martinez Canillas, Yang Yingliang, linux-fbdev, dri-devel,
kernel-janitors
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>
---
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;
goto err_disable;
+ }
addr = pci_resource_start(dp, 0);
- if (addr == 0)
+ if (addr == 0) {
+ rc = -EINVAL;
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;
}
--
2.39.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] fbdev: chipsfb: Fix error codes in chipsfb_pci_init()
2023-02-27 10:07 [PATCH] fbdev: chipsfb: Fix error codes in chipsfb_pci_init() Dan Carpenter
@ 2023-02-27 10:13 ` Thomas Zimmermann
2023-02-27 10:27 ` Dan Carpenter
0 siblings, 1 reply; 3+ messages in thread
From: Thomas Zimmermann @ 2023-02-27 10:13 UTC (permalink / raw)
To: Dan Carpenter
Cc: Javier Martinez Canillas, Yang Yingliang, linux-fbdev, dri-devel,
kernel-janitors
[-- 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 --]
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] fbdev: chipsfb: Fix error codes in chipsfb_pci_init()
2023-02-27 10:13 ` Thomas Zimmermann
@ 2023-02-27 10:27 ` Dan Carpenter
0 siblings, 0 replies; 3+ messages in thread
From: Dan Carpenter @ 2023-02-27 10:27 UTC (permalink / raw)
To: Thomas Zimmermann
Cc: Javier Martinez Canillas, Yang Yingliang, linux-fbdev, dri-devel,
kernel-janitors
On Mon, Feb 27, 2023 at 11:13:19AM +0100, Thomas Zimmermann wrote:
> 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.
Sorry, I read the original code and my mind saw -EINVAL where it was
actually -ENODEV as you say. Will resend.
regards,
dan carpenter
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2023-02-27 16:45 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-02-27 10:07 [PATCH] fbdev: chipsfb: Fix error codes in chipsfb_pci_init() Dan Carpenter
2023-02-27 10:13 ` Thomas Zimmermann
2023-02-27 10:27 ` Dan Carpenter
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).