Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1574902
| From | Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [PATCH] omapfb: dss: Handle return error in dss_init_ports. |
| Date | 2017-02-06 16:30 +0100 |
| Message-ID | <t7ToS-6Gk-15@gated-at.bofh.it> (permalink) |
| References | <t7ToS-6Gk-17@gated-at.bofh.it> <t6La2-1wS-5@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
Hi,
On Friday, February 03, 2017 05:53:45 PM Arvind Yadav wrote:
> Here, dss_init_ports is not handling return error form
> dpi_init_port and sdi_init_port. Now dss_init_ports is returning
> always 0. And it's making below code as a dead code.
>
> static int dss_bind(struct device *dev)
> {
> .
> .
> r = dss_init_ports(pdev); //dss_init_ports will return always 0
> if (r)// This condition will always false
> goto err_init_ports; //Dead Code
> .
> .
> }
>
> This change is to handle return error from dpi_init_port and
> sdi_init_port. Also, It will remove dead code from function 'dss_bind'.
>
> Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com>
> ---
> drivers/video/fbdev/omap2/omapfb/dss/dss.c | 7 ++++---
> 1 file changed, 4 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/video/fbdev/omap2/omapfb/dss/dss.c b/drivers/video/fbdev/omap2/omapfb/dss/dss.c
> index 47d7f69..15a0dab 100644
> --- a/drivers/video/fbdev/omap2/omapfb/dss/dss.c
> +++ b/drivers/video/fbdev/omap2/omapfb/dss/dss.c
> @@ -946,6 +946,7 @@ static int dss_init_ports(struct platform_device *pdev)
> struct device_node *parent = pdev->dev.of_node;
> struct device_node *port;
> int r;
> + int ret = 0;
>
> if (parent == NULL)
> return 0;
> @@ -972,17 +973,17 @@ static int dss_init_ports(struct platform_device *pdev)
>
> switch (port_type) {
> case OMAP_DISPLAY_TYPE_DPI:
> - dpi_init_port(pdev, port);
> + ret = dpi_init_port(pdev, port);
> break;
> case OMAP_DISPLAY_TYPE_SDI:
> - sdi_init_port(pdev, port);
> + ret = sdi_init_port(pdev, port);
> break;
> default:
> break;
> }
> } while ((port = omapdss_of_get_next_port(parent, port)) != NULL);
Shouldn't initialization be stopped after the first failure?
i.e.:
} while (!ret && (port = omapdss_of_get_next_port(parent, port)) != NULL);
Also the cleanup of the partial initialization is missing.
From looking at the code we should do something like this
before returning:
if (ret)
dss_uninit_ports(pdev);
(dpi_uninit_port() & sdi_uninit_port() skip not fully
initialized ports)
> - return 0;
> + return ret;
> }
>
> static void dss_uninit_ports(struct platform_device *pdev)
Best regards,
--
Bartlomiej Zolnierkiewicz
Samsung R&D Institute Poland
Samsung Electronics
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH] omapfb: dss: Handle return error in dss_init_ports. Arvind Yadav <arvind.yadav.cs@gmail.com> - 2017-02-03 13:30 +0100
Re: [PATCH] omapfb: dss: Handle return error in dss_init_ports. Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com> - 2017-02-06 16:30 +0100
Re: [PATCH] omapfb: dss: Handle return error in dss_init_ports. Arvind Yadav <arvind.yadav.cs@gmail.com> - 2017-02-07 13:20 +0100
Re: [PATCH] omapfb: dss: Handle return error in dss_init_ports. Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com> - 2017-02-08 11:40 +0100
Re: [PATCH] omapfb: dss: Handle return error in dss_init_ports. Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com> - 2017-02-08 15:40 +0100
Re: [PATCH] omapfb: dss: Handle return error in dss_init_ports. Arvind Yadav <arvind.yadav.cs@gmail.com> - 2017-02-09 11:10 +0100
csiph-web