* [PATCH v2] omapfb: dss: Handle return error in dss_init_ports.
@ 2017-02-09 9:58 ` Arvind Yadav
2017-02-09 11:22 ` Bartlomiej Zolnierkiewicz
2017-02-09 21:05 ` kbuild test robot
0 siblings, 2 replies; 3+ messages in thread
From: Arvind Yadav @ 2017-02-09 9:58 UTC (permalink / raw)
To: tomi.valkeinen, b.zolnierkie; +Cc: linux-omap, linux-fbdev, linux-kernel
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 | 10 +++++++---
1 file changed, 7 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..87eb10c 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,20 @@ 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);
- return 0;
+ if (ret)
+ dss_uninit_ports(pdev);
+
+ return ret;
}
static void dss_uninit_ports(struct platform_device *pdev)
--
1.9.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH v2] omapfb: dss: Handle return error in dss_init_ports.
2017-02-09 9:58 ` [PATCH v2] omapfb: dss: Handle return error in dss_init_ports Arvind Yadav
@ 2017-02-09 11:22 ` Bartlomiej Zolnierkiewicz
2017-02-09 21:05 ` kbuild test robot
1 sibling, 0 replies; 3+ messages in thread
From: Bartlomiej Zolnierkiewicz @ 2017-02-09 11:22 UTC (permalink / raw)
To: Arvind Yadav; +Cc: tomi.valkeinen, linux-omap, linux-fbdev, linux-kernel
Hi,
On Thursday, February 09, 2017 03:28:01 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>
> ---
Please include version history here when submitting new
versions.
> drivers/video/fbdev/omap2/omapfb/dss/dss.c | 10 +++++++---
> 1 file changed, 7 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..87eb10c 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,20 @@ 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);
What about the other issue raised by me?
Shouldn't initialization be stopped after first failure?
i.e.:
} while (!ret && (port = omapdss_of_get_next_port(parent, port)) != NULL);
Otherwise it is possible to return a success in case when
- initialization of the first port fails
- initialization of the second port is successful
> - return 0;
> + if (ret)
> + dss_uninit_ports(pdev);
> +
> + return ret;
> }
>
> static void dss_uninit_ports(struct platform_device *pdev)
Best regards,
--
Bartlomiej Zolnierkiewicz
Samsung R&D Institute Poland
Samsung Electronics
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH v2] omapfb: dss: Handle return error in dss_init_ports.
2017-02-09 9:58 ` [PATCH v2] omapfb: dss: Handle return error in dss_init_ports Arvind Yadav
2017-02-09 11:22 ` Bartlomiej Zolnierkiewicz
@ 2017-02-09 21:05 ` kbuild test robot
1 sibling, 0 replies; 3+ messages in thread
From: kbuild test robot @ 2017-02-09 21:05 UTC (permalink / raw)
To: Arvind Yadav
Cc: kbuild-all, tomi.valkeinen, b.zolnierkie, linux-omap,
linux-fbdev, linux-kernel
[-- Attachment #1: Type: text/plain, Size: 2262 bytes --]
Hi Arvind,
[auto build test ERROR on linus/master]
[also build test ERROR on v4.10-rc7 next-20170209]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]
url: https://github.com/0day-ci/linux/commits/Arvind-Yadav/omapfb-dss-Handle-return-error-in-dss_init_ports/20170209-201712
config: arm-omap2plus_defconfig (attached as .config)
compiler: arm-linux-gnueabi-gcc (Debian 6.1.1-9) 6.1.1 20160705
reproduce:
wget https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
make.cross ARCH=arm
All error/warnings (new ones prefixed by >>):
drivers/video/fbdev/omap2/omapfb/dss/dss.c: In function 'dss_init_ports':
>> drivers/video/fbdev/omap2/omapfb/dss/dss.c:987:3: error: implicit declaration of function 'dss_uninit_ports' [-Werror=implicit-function-declaration]
dss_uninit_ports(pdev);
^~~~~~~~~~~~~~~~
drivers/video/fbdev/omap2/omapfb/dss/dss.c: At top level:
>> drivers/video/fbdev/omap2/omapfb/dss/dss.c:992:13: warning: conflicting types for 'dss_uninit_ports'
static void dss_uninit_ports(struct platform_device *pdev)
^~~~~~~~~~~~~~~~
>> drivers/video/fbdev/omap2/omapfb/dss/dss.c:992:13: error: static declaration of 'dss_uninit_ports' follows non-static declaration
drivers/video/fbdev/omap2/omapfb/dss/dss.c:987:3: note: previous implicit declaration of 'dss_uninit_ports' was here
dss_uninit_ports(pdev);
^~~~~~~~~~~~~~~~
cc1: some warnings being treated as errors
vim +/dss_uninit_ports +987 drivers/video/fbdev/omap2/omapfb/dss/dss.c
981 default:
982 break;
983 }
984 } while ((port = omapdss_of_get_next_port(parent, port)) != NULL);
985
986 if (ret)
> 987 dss_uninit_ports(pdev);
988
989 return ret;
990 }
991
> 992 static void dss_uninit_ports(struct platform_device *pdev)
993 {
994 struct device_node *parent = pdev->dev.of_node;
995 struct device_node *port;
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 28765 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2017-02-09 21:09 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <CGME20170209095916epcas1p46d7faa4233dfa9b0a0a62aa64c293674@epcas1p4.samsung.com>
2017-02-09 9:58 ` [PATCH v2] omapfb: dss: Handle return error in dss_init_ports Arvind Yadav
2017-02-09 11:22 ` Bartlomiej Zolnierkiewicz
2017-02-09 21:05 ` kbuild test robot
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).