* [PATCH 1/1] video: fbdev-LCDC: Deletion of an unnecessary check before the function call "vfree"
[not found] ` <5317A59D.4@users.sourceforge.net>
@ 2014-11-22 16:00 ` SF Markus Elfring
2014-12-04 14:19 ` Tomi Valkeinen
2014-11-23 10:11 ` [PATCH 1/1] video: uvesafb: Deletion of an unnecessary check before the function call "uvesafb_free" SF Markus Elfring
` (14 subsequent siblings)
15 siblings, 1 reply; 38+ messages in thread
From: SF Markus Elfring @ 2014-11-22 16:00 UTC (permalink / raw)
To: Jean-Christophe Plagniol-Villard, Tomi Valkeinen, linux-fbdev
Cc: LKML, kernel-janitors, Julia Lawall
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Sat, 22 Nov 2014 16:51:31 +0100
The vfree() function performs also input parameter validation.
Thus the test around the call is not needed.
This issue was detected by using the Coccinelle software.
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
drivers/video/fbdev/sh_mobile_lcdcfb.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/drivers/video/fbdev/sh_mobile_lcdcfb.c b/drivers/video/fbdev/sh_mobile_lcdcfb.c
index 2bcc84a..cfde21d 100644
--- a/drivers/video/fbdev/sh_mobile_lcdcfb.c
+++ b/drivers/video/fbdev/sh_mobile_lcdcfb.c
@@ -2181,8 +2181,7 @@ sh_mobile_lcdc_channel_fb_cleanup(struct sh_mobile_lcdc_chan *ch)
if (!info || !info->device)
return;
- if (ch->sglist)
- vfree(ch->sglist);
+ vfree(ch->sglist);
fb_dealloc_cmap(&info->cmap);
framebuffer_release(info);
--
2.1.3
^ permalink raw reply related [flat|nested] 38+ messages in thread
* [PATCH 1/1] video: uvesafb: Deletion of an unnecessary check before the function call "uvesafb_free"
[not found] ` <5317A59D.4@users.sourceforge.net>
2014-11-22 16:00 ` [PATCH 1/1] video: fbdev-LCDC: Deletion of an unnecessary check before the function call "vfree" SF Markus Elfring
@ 2014-11-23 10:11 ` SF Markus Elfring
2014-11-23 10:44 ` [PATCH 1/1] video: udlfb: Deletion of unnecessary checks before the function call "vfree" SF Markus Elfring
` (13 subsequent siblings)
15 siblings, 0 replies; 38+ messages in thread
From: SF Markus Elfring @ 2014-11-23 10:11 UTC (permalink / raw)
To: Jean-Christophe Plagniol-Villard, Michal Januszewski,
Tomi Valkeinen, linux-fbdev
Cc: LKML, kernel-janitors, Julia Lawall
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Sun, 23 Nov 2014 11:00:26 +0100
The uvesafb_free() function tests whether its argument is NULL and then
returns immediately. Thus the test around the call is not needed.
This issue was detected by using the Coccinelle software.
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
drivers/video/fbdev/uvesafb.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/drivers/video/fbdev/uvesafb.c b/drivers/video/fbdev/uvesafb.c
index 509d452..f718627 100644
--- a/drivers/video/fbdev/uvesafb.c
+++ b/drivers/video/fbdev/uvesafb.c
@@ -1219,8 +1219,7 @@ static int uvesafb_release(struct fb_info *info, int user)
uvesafb_vbe_state_restore(par, par->vbe_state_orig);
out:
atomic_dec(&par->ref_count);
- if (task)
- uvesafb_free(task);
+ uvesafb_free(task);
return 0;
}
--
2.1.3
^ permalink raw reply related [flat|nested] 38+ messages in thread
* [PATCH 1/1] video: udlfb: Deletion of unnecessary checks before the function call "vfree"
[not found] ` <5317A59D.4@users.sourceforge.net>
2014-11-22 16:00 ` [PATCH 1/1] video: fbdev-LCDC: Deletion of an unnecessary check before the function call "vfree" SF Markus Elfring
2014-11-23 10:11 ` [PATCH 1/1] video: uvesafb: Deletion of an unnecessary check before the function call "uvesafb_free" SF Markus Elfring
@ 2014-11-23 10:44 ` SF Markus Elfring
2014-11-23 11:33 ` [PATCH 1/1] video: smscufx: " SF Markus Elfring
` (12 subsequent siblings)
15 siblings, 0 replies; 38+ messages in thread
From: SF Markus Elfring @ 2014-11-23 10:44 UTC (permalink / raw)
To: Jean-Christophe Plagniol-Villard, Tomi Valkeinen, linux-fbdev
Cc: LKML, kernel-janitors, Julia Lawall
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Sun, 23 Nov 2014 11:40:47 +0100
The vfree() function performs also input parameter validation. Thus the test
around the call is not needed.
This issue was detected by using the Coccinelle software.
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
drivers/video/fbdev/udlfb.c | 9 +++------
1 file changed, 3 insertions(+), 6 deletions(-)
diff --git a/drivers/video/fbdev/udlfb.c b/drivers/video/fbdev/udlfb.c
index 77b890e..01fff0c 100644
--- a/drivers/video/fbdev/udlfb.c
+++ b/drivers/video/fbdev/udlfb.c
@@ -922,8 +922,7 @@ static void dlfb_free(struct kref *kref)
{
struct dlfb_data *dev = container_of(kref, struct dlfb_data, kref);
- if (dev->backing_buffer)
- vfree(dev->backing_buffer);
+ vfree(dev->backing_buffer);
kfree(dev->edid);
@@ -953,8 +952,7 @@ static void dlfb_free_framebuffer(struct dlfb_data *dev)
fb_dealloc_cmap(&info->cmap);
if (info->monspecs.modedb)
fb_destroy_modedb(info->monspecs.modedb);
- if (info->screen_base)
- vfree(info->screen_base);
+ vfree(info->screen_base);
fb_destroy_modelist(&info->modelist);
@@ -1203,8 +1201,7 @@ static int dlfb_realloc_framebuffer(struct dlfb_data *dev, struct fb_info *info)
if (!new_back)
pr_info("No shadow/backing buffer allocated\n");
else {
- if (dev->backing_buffer)
- vfree(dev->backing_buffer);
+ vfree(dev->backing_buffer);
dev->backing_buffer = new_back;
}
}
--
2.1.3
^ permalink raw reply related [flat|nested] 38+ messages in thread
* [PATCH 1/1] video: smscufx: Deletion of unnecessary checks before the function call "vfree"
[not found] ` <5317A59D.4@users.sourceforge.net>
` (2 preceding siblings ...)
2014-11-23 10:44 ` [PATCH 1/1] video: udlfb: Deletion of unnecessary checks before the function call "vfree" SF Markus Elfring
@ 2014-11-23 11:33 ` SF Markus Elfring
2014-11-23 12:00 ` [PATCH 1/1] video: fbdev-SIS: Deletion of unnecessary checks before the function call "pci_dev_put" SF Markus Elfring
` (11 subsequent siblings)
15 siblings, 0 replies; 38+ messages in thread
From: SF Markus Elfring @ 2014-11-23 11:33 UTC (permalink / raw)
To: Jean-Christophe Plagniol-Villard, Steve Glendinning,
Tomi Valkeinen, linux-fbdev
Cc: LKML, kernel-janitors, Julia Lawall
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Sun, 23 Nov 2014 12:30:33 +0100
The vfree() function performs also input parameter validation. Thus the test
around the call is not needed.
This issue was detected by using the Coccinelle software.
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
drivers/video/fbdev/smscufx.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/drivers/video/fbdev/smscufx.c b/drivers/video/fbdev/smscufx.c
index d513ed6..9279e5f 100644
--- a/drivers/video/fbdev/smscufx.c
+++ b/drivers/video/fbdev/smscufx.c
@@ -1142,8 +1142,7 @@ static void ufx_free_framebuffer_work(struct work_struct *work)
fb_dealloc_cmap(&info->cmap);
if (info->monspecs.modedb)
fb_destroy_modedb(info->monspecs.modedb);
- if (info->screen_base)
- vfree(info->screen_base);
+ vfree(info->screen_base);
fb_destroy_modelist(&info->modelist);
@@ -1743,8 +1742,7 @@ error:
fb_dealloc_cmap(&info->cmap);
if (info->monspecs.modedb)
fb_destroy_modedb(info->monspecs.modedb);
- if (info->screen_base)
- vfree(info->screen_base);
+ vfree(info->screen_base);
fb_destroy_modelist(&info->modelist);
--
2.1.3
^ permalink raw reply related [flat|nested] 38+ messages in thread
* [PATCH 1/1] video: fbdev-SIS: Deletion of unnecessary checks before the function call "pci_dev_put"
[not found] ` <5317A59D.4@users.sourceforge.net>
` (3 preceding siblings ...)
2014-11-23 11:33 ` [PATCH 1/1] video: smscufx: " SF Markus Elfring
@ 2014-11-23 12:00 ` SF Markus Elfring
2014-11-23 13:14 ` [PATCH 1/1] video: fbdev-OMAP2: Deletion of unnecessary checks before the function call "i2c_put_ada SF Markus Elfring
` (10 subsequent siblings)
15 siblings, 0 replies; 38+ messages in thread
From: SF Markus Elfring @ 2014-11-23 12:00 UTC (permalink / raw)
To: Jean-Christophe Plagniol-Villard, Thomas Winischhofer,
Tomi Valkeinen, linux-fbdev
Cc: LKML, kernel-janitors, Julia Lawall
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Sun, 23 Nov 2014 12:55:25 +0100
The pci_dev_put() function tests whether its argument is NULL
and then returns immediately. Thus the test around the call
is not needed.
This issue was detected by using the Coccinelle software.
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
drivers/video/fbdev/sis/sis_main.c | 14 +++++---------
1 file changed, 5 insertions(+), 9 deletions(-)
diff --git a/drivers/video/fbdev/sis/sis_main.c b/drivers/video/fbdev/sis/sis_main.c
index 3f12a2d..6548a3e 100644
--- a/drivers/video/fbdev/sis/sis_main.c
+++ b/drivers/video/fbdev/sis/sis_main.c
@@ -5989,7 +5989,7 @@ static int sisfb_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
if(!ivideo->sisvga_enabled) {
if(pci_enable_device(pdev)) {
- if(ivideo->nbridge) pci_dev_put(ivideo->nbridge);
+ pci_dev_put(ivideo->nbridge);
framebuffer_release(sis_fb_info);
return -EIO;
}
@@ -6202,10 +6202,8 @@ error_0: iounmap(ivideo->video_vbase);
error_1: release_mem_region(ivideo->video_base, ivideo->video_size);
error_2: release_mem_region(ivideo->mmio_base, ivideo->mmio_size);
error_3: vfree(ivideo->bios_abase);
- if(ivideo->lpcdev)
- pci_dev_put(ivideo->lpcdev);
- if(ivideo->nbridge)
- pci_dev_put(ivideo->nbridge);
+ pci_dev_put(ivideo->lpcdev);
+ pci_dev_put(ivideo->nbridge);
if(!ivideo->sisvga_enabled)
pci_disable_device(pdev);
framebuffer_release(sis_fb_info);
@@ -6505,11 +6503,9 @@ static void sisfb_remove(struct pci_dev *pdev)
vfree(ivideo->bios_abase);
- if(ivideo->lpcdev)
- pci_dev_put(ivideo->lpcdev);
+ pci_dev_put(ivideo->lpcdev);
- if(ivideo->nbridge)
- pci_dev_put(ivideo->nbridge);
+ pci_dev_put(ivideo->nbridge);
#ifdef CONFIG_MTRR
/* Release MTRR region */
--
2.1.3
^ permalink raw reply related [flat|nested] 38+ messages in thread
* [PATCH 1/1] video: fbdev-OMAP2: Deletion of unnecessary checks before the function call "i2c_put_ada
[not found] ` <5317A59D.4@users.sourceforge.net>
` (4 preceding siblings ...)
2014-11-23 12:00 ` [PATCH 1/1] video: fbdev-SIS: Deletion of unnecessary checks before the function call "pci_dev_put" SF Markus Elfring
@ 2014-11-23 13:14 ` SF Markus Elfring
2014-11-23 14:20 ` [PATCH 1/1] video: mx3fb: Deletion of an unnecessary check before the function call "backlight_devic SF Markus Elfring
` (9 subsequent siblings)
15 siblings, 0 replies; 38+ messages in thread
From: SF Markus Elfring @ 2014-11-23 13:14 UTC (permalink / raw)
To: Jean-Christophe Plagniol-Villard, Tomi Valkeinen, linux-omap,
linux-fbdev
Cc: LKML, kernel-janitors, Julia Lawall
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Sun, 23 Nov 2014 14:07:22 +0100
The i2c_put_adapter() function tests whether its argument is NULL
and then returns immediately. Thus the test around the call is not needed.
This issue was detected by using the Coccinelle software.
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
drivers/video/fbdev/omap2/displays-new/connector-dvi.c | 9 +++------
1 file changed, 3 insertions(+), 6 deletions(-)
diff --git a/drivers/video/fbdev/omap2/displays-new/connector-dvi.c b/drivers/video/fbdev/omap2/displays-new/connector-dvi.c
index 74de2bc..196c61a 100644
--- a/drivers/video/fbdev/omap2/displays-new/connector-dvi.c
+++ b/drivers/video/fbdev/omap2/displays-new/connector-dvi.c
@@ -262,8 +262,7 @@ static int dvic_probe_pdata(struct platform_device *pdev)
in = omap_dss_find_output(pdata->source);
if (in = NULL) {
- if (ddata->i2c_adapter)
- i2c_put_adapter(ddata->i2c_adapter);
+ i2c_put_adapter(ddata->i2c_adapter);
dev_err(&pdev->dev, "Failed to find video source\n");
return -EPROBE_DEFER;
@@ -352,8 +351,7 @@ static int dvic_probe(struct platform_device *pdev)
err_reg:
omap_dss_put_device(ddata->in);
- if (ddata->i2c_adapter)
- i2c_put_adapter(ddata->i2c_adapter);
+ i2c_put_adapter(ddata->i2c_adapter);
return r;
}
@@ -371,8 +369,7 @@ static int __exit dvic_remove(struct platform_device *pdev)
omap_dss_put_device(in);
- if (ddata->i2c_adapter)
- i2c_put_adapter(ddata->i2c_adapter);
+ i2c_put_adapter(ddata->i2c_adapter);
return 0;
}
--
2.1.3
^ permalink raw reply related [flat|nested] 38+ messages in thread
* [PATCH 1/1] video: mx3fb: Deletion of an unnecessary check before the function call "backlight_devic
[not found] ` <5317A59D.4@users.sourceforge.net>
` (5 preceding siblings ...)
2014-11-23 13:14 ` [PATCH 1/1] video: fbdev-OMAP2: Deletion of unnecessary checks before the function call "i2c_put_ada SF Markus Elfring
@ 2014-11-23 14:20 ` SF Markus Elfring
2014-11-23 15:00 ` [PATCH 1/1] video: fbdev-MMP: Deletion of an unnecessary check before the function call "mmp_unregis SF Markus Elfring
` (8 subsequent siblings)
15 siblings, 0 replies; 38+ messages in thread
From: SF Markus Elfring @ 2014-11-23 14:20 UTC (permalink / raw)
To: Jean-Christophe Plagniol-Villard, Tomi Valkeinen, linux-fbdev
Cc: LKML, kernel-janitors, Julia Lawall
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Sun, 23 Nov 2014 15:15:29 +0100
The backlight_device_unregister() function tests whether its argument is NULL
and then returns immediately. Thus the test around the call is not needed.
This issue was detected by using the Coccinelle software.
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
drivers/video/fbdev/mx3fb.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/drivers/video/fbdev/mx3fb.c b/drivers/video/fbdev/mx3fb.c
index c645a0a..b2d2151 100644
--- a/drivers/video/fbdev/mx3fb.c
+++ b/drivers/video/fbdev/mx3fb.c
@@ -334,8 +334,7 @@ static void mx3fb_init_backlight(struct mx3fb_data *fbd)
static void mx3fb_exit_backlight(struct mx3fb_data *fbd)
{
- if (fbd->bl)
- backlight_device_unregister(fbd->bl);
+ backlight_device_unregister(fbd->bl);
}
static void mx3fb_dma_done(void *);
--
2.1.3
^ permalink raw reply related [flat|nested] 38+ messages in thread
* [PATCH 1/1] video: fbdev-MMP: Deletion of an unnecessary check before the function call "mmp_unregis
[not found] ` <5317A59D.4@users.sourceforge.net>
` (6 preceding siblings ...)
2014-11-23 14:20 ` [PATCH 1/1] video: mx3fb: Deletion of an unnecessary check before the function call "backlight_devic SF Markus Elfring
@ 2014-11-23 15:00 ` SF Markus Elfring
2014-11-23 15:33 ` [PATCH 1/1] video: fbdev-VIA: Deletion of an unnecessary check before the function call "framebuffer SF Markus Elfring
` (7 subsequent siblings)
15 siblings, 0 replies; 38+ messages in thread
From: SF Markus Elfring @ 2014-11-23 15:00 UTC (permalink / raw)
To: Jean-Christophe Plagniol-Villard, Tomi Valkeinen, linux-fbdev
Cc: LKML, kernel-janitors, Julia Lawall
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Sun, 23 Nov 2014 15:45:03 +0100
The mmp_unregister_path() function tests whether its argument is NULL
and then returns immediately. Thus the test around the call is not needed.
This issue was detected by using the Coccinelle software.
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
drivers/video/fbdev/mmp/hw/mmp_ctrl.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/drivers/video/fbdev/mmp/hw/mmp_ctrl.c b/drivers/video/fbdev/mmp/hw/mmp_ctrl.c
index 8621a9f..3c12bd8 100644
--- a/drivers/video/fbdev/mmp/hw/mmp_ctrl.c
+++ b/drivers/video/fbdev/mmp/hw/mmp_ctrl.c
@@ -441,8 +441,7 @@ static void path_deinit(struct mmphw_path_plat *path_plat)
if (!path_plat)
return;
- if (path_plat->path)
- mmp_unregister_path(path_plat->path);
+ mmp_unregister_path(path_plat->path);
}
static int mmphw_probe(struct platform_device *pdev)
--
2.1.3
^ permalink raw reply related [flat|nested] 38+ messages in thread
* [PATCH 1/1] video: fbdev-VIA: Deletion of an unnecessary check before the function call "framebuffer
[not found] ` <5317A59D.4@users.sourceforge.net>
` (7 preceding siblings ...)
2014-11-23 15:00 ` [PATCH 1/1] video: fbdev-MMP: Deletion of an unnecessary check before the function call "mmp_unregis SF Markus Elfring
@ 2014-11-23 15:33 ` SF Markus Elfring
2014-11-23 16:10 ` [PATCH 1/1] video: uvesafb: Deletion of an unnecessary check before the function call "platform_devi SF Markus Elfring
` (6 subsequent siblings)
15 siblings, 0 replies; 38+ messages in thread
From: SF Markus Elfring @ 2014-11-23 15:33 UTC (permalink / raw)
To: Florian Tobias Schandinat, Jean-Christophe Plagniol-Villard,
Tomi Valkeinen, linux-fbdev
Cc: LKML, kernel-janitors, Julia Lawall
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Sun, 23 Nov 2014 16:30:05 +0100
The framebuffer_release() function tests whether its argument is NULL
and then returns immediately. Thus the test around the call is not needed.
This issue was detected by using the Coccinelle software.
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
drivers/video/fbdev/via/viafbdev.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/drivers/video/fbdev/via/viafbdev.c b/drivers/video/fbdev/via/viafbdev.c
index 325c43c..f9718f0 100644
--- a/drivers/video/fbdev/via/viafbdev.c
+++ b/drivers/video/fbdev/via/viafbdev.c
@@ -1937,8 +1937,7 @@ out_fb1_unreg_lcd_cle266:
out_dealloc_cmap:
fb_dealloc_cmap(&viafbinfo->cmap);
out_fb1_release:
- if (viafbinfo1)
- framebuffer_release(viafbinfo1);
+ framebuffer_release(viafbinfo1);
out_fb_release:
i2c_bus_free(viaparinfo->shared);
framebuffer_release(viafbinfo);
--
2.1.3
^ permalink raw reply related [flat|nested] 38+ messages in thread
* [PATCH 1/1] video: uvesafb: Deletion of an unnecessary check before the function call "platform_devi
[not found] ` <5317A59D.4@users.sourceforge.net>
` (8 preceding siblings ...)
2014-11-23 15:33 ` [PATCH 1/1] video: fbdev-VIA: Deletion of an unnecessary check before the function call "framebuffer SF Markus Elfring
@ 2014-11-23 16:10 ` SF Markus Elfring
2014-11-23 16:40 ` [PATCH 1/1] backlight: lp8788: Deletion of an unnecessary check before the function call "backlight_ SF Markus Elfring
` (5 subsequent siblings)
15 siblings, 0 replies; 38+ messages in thread
From: SF Markus Elfring @ 2014-11-23 16:10 UTC (permalink / raw)
To: Jean-Christophe Plagniol-Villard, Michal Januszewski,
Tomi Valkeinen, linux-fbdev
Cc: LKML, kernel-janitors, Julia Lawall
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Sun, 23 Nov 2014 17:05:18 +0100
The platform_device_put() function tests whether its argument is NULL
and then returns immediately. Thus the test around the call is not needed.
This issue was detected by using the Coccinelle software.
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
drivers/video/fbdev/uvesafb.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/drivers/video/fbdev/uvesafb.c b/drivers/video/fbdev/uvesafb.c
index 509d452..17b2e8c 100644
--- a/drivers/video/fbdev/uvesafb.c
+++ b/drivers/video/fbdev/uvesafb.c
@@ -1923,8 +1923,7 @@ static int uvesafb_init(void)
err = -ENOMEM;
if (err) {
- if (uvesafb_device)
- platform_device_put(uvesafb_device);
+ platform_device_put(uvesafb_device);
platform_driver_unregister(&uvesafb_driver);
cn_del_callback(&uvesafb_cn_id);
return err;
--
2.1.3
^ permalink raw reply related [flat|nested] 38+ messages in thread
* [PATCH 1/1] backlight: lp8788: Deletion of an unnecessary check before the function call "backlight_
[not found] ` <5317A59D.4@users.sourceforge.net>
` (9 preceding siblings ...)
2014-11-23 16:10 ` [PATCH 1/1] video: uvesafb: Deletion of an unnecessary check before the function call "platform_devi SF Markus Elfring
@ 2014-11-23 16:40 ` SF Markus Elfring
2014-11-24 10:09 ` [PATCH 1/1] backlight: lp8788: Deletion of an unnecessary check before the function call "backli Lee Jones
2014-11-24 10:10 ` Lee Jones
2015-01-19 17:54 ` [PATCH 0/9] video: fbdev: Deletion of some unnecessary checks SF Markus Elfring
` (4 subsequent siblings)
15 siblings, 2 replies; 38+ messages in thread
From: SF Markus Elfring @ 2014-11-23 16:40 UTC (permalink / raw)
To: Bryan Wu, Jean-Christophe Plagniol-Villard, Jingoo Han, Lee Jones,
Tomi Valkeinen, linux-fbdev
Cc: LKML, kernel-janitors, Julia Lawall
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Sun, 23 Nov 2014 17:33:08 +0100
The backlight_device_unregister() function tests whether its argument is NULL
and then returns immediately. Thus the test around the call is not needed.
This issue was detected by using the Coccinelle software.
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
drivers/video/backlight/lp8788_bl.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/drivers/video/backlight/lp8788_bl.c b/drivers/video/backlight/lp8788_bl.c
index d6c4f6a..24a055c 100644
--- a/drivers/video/backlight/lp8788_bl.c
+++ b/drivers/video/backlight/lp8788_bl.c
@@ -221,8 +221,7 @@ static void lp8788_backlight_unregister(struct lp8788_bl *bl)
{
struct backlight_device *bl_dev = bl->bl_dev;
- if (bl_dev)
- backlight_device_unregister(bl_dev);
+ backlight_device_unregister(bl_dev);
}
static ssize_t lp8788_get_bl_ctl_mode(struct device *dev,
--
2.1.3
^ permalink raw reply related [flat|nested] 38+ messages in thread
* Re: [PATCH 1/1] backlight: lp8788: Deletion of an unnecessary check before the function call "backli
2014-11-23 16:40 ` [PATCH 1/1] backlight: lp8788: Deletion of an unnecessary check before the function call "backlight_ SF Markus Elfring
@ 2014-11-24 10:09 ` Lee Jones
2014-11-24 10:10 ` Lee Jones
1 sibling, 0 replies; 38+ messages in thread
From: Lee Jones @ 2014-11-24 10:09 UTC (permalink / raw)
To: SF Markus Elfring
Cc: Bryan Wu, Jean-Christophe Plagniol-Villard, Jingoo Han,
Tomi Valkeinen, linux-fbdev, LKML, kernel-janitors, Julia Lawall
On Sun, 23 Nov 2014, SF Markus Elfring wrote:
> From: Markus Elfring <elfring@users.sourceforge.net>
> Date: Sun, 23 Nov 2014 17:33:08 +0100
What format is this?
Can you use `git format-patch` and `git send-email` instead please?
> The backlight_device_unregister() function tests whether its argument is NULL
> and then returns immediately. Thus the test around the call is not needed.
>
> This issue was detected by using the Coccinelle software.
>
> Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
> ---
> drivers/video/backlight/lp8788_bl.c | 3 +--
> 1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/drivers/video/backlight/lp8788_bl.c b/drivers/video/backlight/lp8788_bl.c
> index d6c4f6a..24a055c 100644
> --- a/drivers/video/backlight/lp8788_bl.c
> +++ b/drivers/video/backlight/lp8788_bl.c
> @@ -221,8 +221,7 @@ static void lp8788_backlight_unregister(struct lp8788_bl *bl)
> {
> struct backlight_device *bl_dev = bl->bl_dev;
>
> - if (bl_dev)
> - backlight_device_unregister(bl_dev);
> + backlight_device_unregister(bl_dev);
> }
>
> static ssize_t lp8788_get_bl_ctl_mode(struct device *dev,
--
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog
^ permalink raw reply [flat|nested] 38+ messages in thread
* Re: [PATCH 1/1] backlight: lp8788: Deletion of an unnecessary check before the function call "backli
2014-11-23 16:40 ` [PATCH 1/1] backlight: lp8788: Deletion of an unnecessary check before the function call "backlight_ SF Markus Elfring
2014-11-24 10:09 ` [PATCH 1/1] backlight: lp8788: Deletion of an unnecessary check before the function call "backli Lee Jones
@ 2014-11-24 10:10 ` Lee Jones
2014-11-24 18:05 ` [PATCH v2] backlight: lp8788: Deletion of a check before backlight_device_unregister() SF Markus Elfring
1 sibling, 1 reply; 38+ messages in thread
From: Lee Jones @ 2014-11-24 10:10 UTC (permalink / raw)
To: SF Markus Elfring
Cc: Bryan Wu, Jean-Christophe Plagniol-Villard, Jingoo Han,
Tomi Valkeinen, linux-fbdev, LKML, kernel-janitors, Julia Lawall
On Sun, 23 Nov 2014, SF Markus Elfring wrote:
> From: Markus Elfring <elfring@users.sourceforge.net>
> Date: Sun, 23 Nov 2014 17:33:08 +0100
>
> The backlight_device_unregister() function tests whether its argument is NULL
> and then returns immediately. Thus the test around the call is not needed.
Also the $SUBJECT should be less than 75 chars.
> This issue was detected by using the Coccinelle software.
>
> Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
> ---
> drivers/video/backlight/lp8788_bl.c | 3 +--
> 1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/drivers/video/backlight/lp8788_bl.c b/drivers/video/backlight/lp8788_bl.c
> index d6c4f6a..24a055c 100644
> --- a/drivers/video/backlight/lp8788_bl.c
> +++ b/drivers/video/backlight/lp8788_bl.c
> @@ -221,8 +221,7 @@ static void lp8788_backlight_unregister(struct lp8788_bl *bl)
> {
> struct backlight_device *bl_dev = bl->bl_dev;
>
> - if (bl_dev)
> - backlight_device_unregister(bl_dev);
> + backlight_device_unregister(bl_dev);
> }
>
> static ssize_t lp8788_get_bl_ctl_mode(struct device *dev,
--
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog
^ permalink raw reply [flat|nested] 38+ messages in thread
* [PATCH v2] backlight: lp8788: Deletion of a check before backlight_device_unregister()
2014-11-24 10:10 ` Lee Jones
@ 2014-11-24 18:05 ` SF Markus Elfring
2015-06-28 12:07 ` SF Markus Elfring
0 siblings, 1 reply; 38+ messages in thread
From: SF Markus Elfring @ 2014-11-24 18:05 UTC (permalink / raw)
To: Lee Jones
Cc: Bryan Wu, Jean-Christophe Plagniol-Villard, Jingoo Han,
Tomi Valkeinen, linux-fbdev, LKML, kernel-janitors, Julia Lawall
From: Markus Elfring <elfring@users.sourceforge.net>
The backlight_device_unregister() function tests whether its argument is NULL
and then returns immediately. Thus the test around the call is not needed.
This issue was detected by using the Coccinelle software.
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
drivers/video/backlight/lp8788_bl.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/drivers/video/backlight/lp8788_bl.c b/drivers/video/backlight/lp8788_bl.c
index d6c4f6a..24a055c 100644
--- a/drivers/video/backlight/lp8788_bl.c
+++ b/drivers/video/backlight/lp8788_bl.c
@@ -221,8 +221,7 @@ static void lp8788_backlight_unregister(struct lp8788_bl *bl)
{
struct backlight_device *bl_dev = bl->bl_dev;
- if (bl_dev)
- backlight_device_unregister(bl_dev);
+ backlight_device_unregister(bl_dev);
}
static ssize_t lp8788_get_bl_ctl_mode(struct device *dev,
--
2.1.3
^ permalink raw reply related [flat|nested] 38+ messages in thread
* Re: [PATCH 1/1] video: fbdev-LCDC: Deletion of an unnecessary check before the function call "vfree"
2014-11-22 16:00 ` [PATCH 1/1] video: fbdev-LCDC: Deletion of an unnecessary check before the function call "vfree" SF Markus Elfring
@ 2014-12-04 14:19 ` Tomi Valkeinen
0 siblings, 0 replies; 38+ messages in thread
From: Tomi Valkeinen @ 2014-12-04 14:19 UTC (permalink / raw)
To: SF Markus Elfring, Jean-Christophe Plagniol-Villard, linux-fbdev
Cc: LKML, kernel-janitors, Julia Lawall
[-- Attachment #1: Type: text/plain, Size: 1170 bytes --]
Hi,
On 22/11/14 18:00, SF Markus Elfring wrote:
> From: Markus Elfring <elfring@users.sourceforge.net>
> Date: Sat, 22 Nov 2014 16:51:31 +0100
>
> The vfree() function performs also input parameter validation.
> Thus the test around the call is not needed.
>
> This issue was detected by using the Coccinelle software.
>
> Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
> ---
> drivers/video/fbdev/sh_mobile_lcdcfb.c | 3 +--
> 1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/drivers/video/fbdev/sh_mobile_lcdcfb.c b/drivers/video/fbdev/sh_mobile_lcdcfb.c
> index 2bcc84a..cfde21d 100644
> --- a/drivers/video/fbdev/sh_mobile_lcdcfb.c
> +++ b/drivers/video/fbdev/sh_mobile_lcdcfb.c
> @@ -2181,8 +2181,7 @@ sh_mobile_lcdc_channel_fb_cleanup(struct sh_mobile_lcdc_chan *ch)
> if (!info || !info->device)
> return;
>
> - if (ch->sglist)
> - vfree(ch->sglist);
> + vfree(ch->sglist);
>
> fb_dealloc_cmap(&info->cmap);
> framebuffer_release(info);
Thanks, I've applied the fbdev patches. Next time, please use
git-format-patch and git-send-email to send a proper patch series.
Tomi
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]
^ permalink raw reply [flat|nested] 38+ messages in thread
* [PATCH 0/9] video: fbdev: Deletion of some unnecessary checks
[not found] ` <5317A59D.4@users.sourceforge.net>
` (10 preceding siblings ...)
2014-11-23 16:40 ` [PATCH 1/1] backlight: lp8788: Deletion of an unnecessary check before the function call "backlight_ SF Markus Elfring
@ 2015-01-19 17:54 ` SF Markus Elfring
2015-01-19 18:00 ` [PATCH 1/9] video: Deletion of checks before the function call "iounmap" SF Markus Elfring
` (8 more replies)
2015-02-05 13:14 ` [PATCH] au1100fb: Delete unnecessary checks before two function calls SF Markus Elfring
` (3 subsequent siblings)
15 siblings, 9 replies; 38+ messages in thread
From: SF Markus Elfring @ 2015-01-19 17:54 UTC (permalink / raw)
To: Antonino Daplas, Ferenc Bakonyi, Hans de Goede, Helge Deller,
James E. J. Bottomley, Jean-Christophe Plagniol-Villard,
Kristoffer Ericson, Peter Jones, Tomi Valkeinen, linux-fbdev,
linux-nvidia, linux-parisc
Cc: LKML, kernel-janitors, Julia Lawall
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Mon, 19 Jan 2015 17:57:25 +0100
Further update suggestions were taken into account after a patch was applied
from static source code analysis.
Markus Elfring (9):
fbdev: Deletion of checks before the function call "iounmap"
One function call less in tdfxfb_probe() after error detection
One function call less in vesafb_probe() after error detection
Add check for return value of ioremap() in cirrusfb_pci_register()
Less function calls in trident_pci_probe() after error detection
One function call less in pvr2fb_common_init() after error detection
One function call less in tgafb_register() after error detection
Less function calls in valkyriefb_init() after error detection
Less function calls in w100fb_probe() after error detection
drivers/video/fbdev/aty/atyfb_base.c | 15 +++++--------
drivers/video/fbdev/cirrusfb.c | 10 ++++++---
drivers/video/fbdev/controlfb.c | 6 ++---
drivers/video/fbdev/efifb.c | 3 +--
drivers/video/fbdev/hgafb.c | 3 +--
drivers/video/fbdev/hpfb.c | 3 +--
drivers/video/fbdev/i810/i810_main.c | 6 ++---
drivers/video/fbdev/macfb.c | 15 +++++--------
drivers/video/fbdev/offb.c | 3 +--
drivers/video/fbdev/pvr2fb.c | 15 ++++++-------
drivers/video/fbdev/s1d13xxxfb.c | 3 +--
drivers/video/fbdev/s3fb.c | 6 ++---
drivers/video/fbdev/sh_mobile_hdmi.c | 6 ++---
drivers/video/fbdev/sh_mobile_lcdcfb.c | 3 +--
drivers/video/fbdev/simplefb.c | 3 +--
drivers/video/fbdev/stifb.c | 3 +--
drivers/video/fbdev/tdfxfb.c | 22 +++++++++----------
drivers/video/fbdev/tgafb.c | 20 ++++++++---------
drivers/video/fbdev/tridentfb.c | 15 +++++++------
drivers/video/fbdev/valkyriefb.c | 37 ++++++++++++++++++-------------
drivers/video/fbdev/vesafb.c | 11 +++++-----
drivers/video/fbdev/w100fb.c | 40 +++++++++++++++++-----------------
22 files changed, 116 insertions(+), 132 deletions(-)
--
2.2.2
^ permalink raw reply [flat|nested] 38+ messages in thread
* [PATCH 1/9] video: Deletion of checks before the function call "iounmap"
2015-01-19 17:54 ` [PATCH 0/9] video: fbdev: Deletion of some unnecessary checks SF Markus Elfring
@ 2015-01-19 18:00 ` SF Markus Elfring
2015-01-19 18:25 ` video: One function call less in tdfxfb_probe() after error detection SF Markus Elfring
` (7 subsequent siblings)
8 siblings, 0 replies; 38+ messages in thread
From: SF Markus Elfring @ 2015-01-19 18:00 UTC (permalink / raw)
To: Antonino Daplas, Ferenc Bakonyi, Hans de Goede, Helge Deller,
James E. J. Bottomley, Jean-Christophe Plagniol-Villard,
Kristoffer Ericson, Peter Jones, Tomi Valkeinen, linux-fbdev,
linux-nvidia, linux-parisc
Cc: LKML, kernel-janitors, Julia Lawall
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Sun, 18 Jan 2015 22:45:39 +0100
The iounmap() function performs also input parameter validation.
Thus the test around the call is not needed.
This issue was detected by using the Coccinelle software.
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
drivers/video/fbdev/aty/atyfb_base.c | 15 +++++----------
drivers/video/fbdev/cirrusfb.c | 3 +--
drivers/video/fbdev/controlfb.c | 6 ++----
drivers/video/fbdev/efifb.c | 3 +--
drivers/video/fbdev/hgafb.c | 3 +--
drivers/video/fbdev/hpfb.c | 3 +--
drivers/video/fbdev/i810/i810_main.c | 6 ++----
drivers/video/fbdev/macfb.c | 15 +++++----------
drivers/video/fbdev/offb.c | 3 +--
drivers/video/fbdev/pvr2fb.c | 3 +--
drivers/video/fbdev/s1d13xxxfb.c | 3 +--
drivers/video/fbdev/s3fb.c | 6 ++----
drivers/video/fbdev/sh_mobile_hdmi.c | 6 ++----
drivers/video/fbdev/sh_mobile_lcdcfb.c | 3 +--
drivers/video/fbdev/simplefb.c | 3 +--
drivers/video/fbdev/stifb.c | 3 +--
drivers/video/fbdev/tdfxfb.c | 6 ++----
drivers/video/fbdev/tgafb.c | 3 +--
drivers/video/fbdev/tridentfb.c | 6 ++----
drivers/video/fbdev/valkyriefb.c | 9 +++------
drivers/video/fbdev/vesafb.c | 6 ++----
drivers/video/fbdev/w100fb.c | 9 +++------
22 files changed, 41 insertions(+), 82 deletions(-)
diff --git a/drivers/video/fbdev/aty/atyfb_base.c b/drivers/video/fbdev/aty/atyfb_base.c
index 37ec09b..0f4b147 100644
--- a/drivers/video/fbdev/aty/atyfb_base.c
+++ b/drivers/video/fbdev/aty/atyfb_base.c
@@ -3605,10 +3605,8 @@ err_release_io:
#ifdef __sparc__
kfree(par->mmap_map);
#else
- if (par->ati_regbase)
- iounmap(par->ati_regbase);
- if (info->screen_base)
- iounmap(info->screen_base);
+ iounmap(par->ati_regbase);
+ iounmap(info->screen_base);
#endif
err_release_mem:
if (par->aux_start)
@@ -3733,13 +3731,10 @@ static void atyfb_remove(struct fb_info *info)
}
#endif
#ifndef __sparc__
- if (par->ati_regbase)
- iounmap(par->ati_regbase);
- if (info->screen_base)
- iounmap(info->screen_base);
+ iounmap(par->ati_regbase);
+ iounmap(info->screen_base);
#ifdef __BIG_ENDIAN
- if (info->sprite.addr)
- iounmap(info->sprite.addr);
+ iounmap(info->sprite.addr);
#endif
#endif
#ifdef __sparc__
diff --git a/drivers/video/fbdev/cirrusfb.c b/drivers/video/fbdev/cirrusfb.c
index d992aa5..d8b3359 100644
--- a/drivers/video/fbdev/cirrusfb.c
+++ b/drivers/video/fbdev/cirrusfb.c
@@ -2164,8 +2164,7 @@ err_release_regions:
#endif
pci_release_regions(pdev);
err_release_fb:
- if (cinfo->laguna_mmio != NULL)
- iounmap(cinfo->laguna_mmio);
+ iounmap(cinfo->laguna_mmio);
framebuffer_release(info);
err_out:
return ret;
diff --git a/drivers/video/fbdev/controlfb.c b/drivers/video/fbdev/controlfb.c
index 080fdd2..d386fed 100644
--- a/drivers/video/fbdev/controlfb.c
+++ b/drivers/video/fbdev/controlfb.c
@@ -1068,10 +1068,8 @@ static void control_cleanup(void)
if (!p)
return;
- if (p->cmap_regs)
- iounmap(p->cmap_regs);
- if (p->control_regs)
- iounmap(p->control_regs);
+ iounmap(p->cmap_regs);
+ iounmap(p->control_regs);
if (p->frame_buffer) {
if (p->control_use_bank2)
p->frame_buffer -= 0x600000;
diff --git a/drivers/video/fbdev/efifb.c b/drivers/video/fbdev/efifb.c
index 4bfff34..a6d08f0 100644
--- a/drivers/video/fbdev/efifb.c
+++ b/drivers/video/fbdev/efifb.c
@@ -65,8 +65,7 @@ static int efifb_setcolreg(unsigned regno, unsigned red, unsigned green,
static void efifb_destroy(struct fb_info *info)
{
- if (info->screen_base)
- iounmap(info->screen_base);
+ iounmap(info->screen_base);
if (request_mem_succeeded)
release_mem_region(info->apertures->ranges[0].base,
info->apertures->ranges[0].size);
diff --git a/drivers/video/fbdev/hgafb.c b/drivers/video/fbdev/hgafb.c
index 5ff9fe2..76b231e 100644
--- a/drivers/video/fbdev/hgafb.c
+++ b/drivers/video/fbdev/hgafb.c
@@ -552,8 +552,7 @@ static int hgafb_probe(struct platform_device *pdev)
if (! hga_card_detect()) {
printk(KERN_INFO "hgafb: HGA card not detected.\n");
- if (hga_vram)
- iounmap(hga_vram);
+ iounmap(hga_vram);
return -EINVAL;
}
diff --git a/drivers/video/fbdev/hpfb.c b/drivers/video/fbdev/hpfb.c
index a1b7e5f..9b47102 100644
--- a/drivers/video/fbdev/hpfb.c
+++ b/drivers/video/fbdev/hpfb.c
@@ -355,8 +355,7 @@ static void hpfb_remove_one(struct dio_dev *d)
iounmap((void *)fb_regs);
release_mem_region(d->resource.start, resource_size(&d->resource));
fb_dealloc_cmap(&fb_info.cmap);
- if (fb_info.screen_base)
- iounmap(fb_info.screen_base);
+ iounmap(fb_info.screen_base);
}
static struct dio_device_id hpfb_dio_tbl[] = {
diff --git a/drivers/video/fbdev/i810/i810_main.c b/drivers/video/fbdev/i810/i810_main.c
index bb674e4..ce3a585 100644
--- a/drivers/video/fbdev/i810/i810_main.c
+++ b/drivers/video/fbdev/i810/i810_main.c
@@ -2105,10 +2105,8 @@ static void i810fb_release_resource(struct fb_info *info,
if (par->i810_gtt.i810_fb_memory)
agp_free_memory(gtt->i810_fb_memory);
- if (par->mmio_start_virtual)
- iounmap(par->mmio_start_virtual);
- if (par->aperture.virtual)
- iounmap(par->aperture.virtual);
+ iounmap(par->mmio_start_virtual);
+ iounmap(par->aperture.virtual);
kfree(par->edid);
if (par->res_flags & FRAMEBUFFER_REQ)
release_mem_region(par->aperture.physical,
diff --git a/drivers/video/fbdev/macfb.c b/drivers/video/fbdev/macfb.c
index cda7587..dde0520 100644
--- a/drivers/video/fbdev/macfb.c
+++ b/drivers/video/fbdev/macfb.c
@@ -541,16 +541,11 @@ static void __init macfb_setup(char *options)
static void __init iounmap_macfb(void)
{
- if (dafb_cmap_regs)
- iounmap(dafb_cmap_regs);
- if (v8_brazil_cmap_regs)
- iounmap(v8_brazil_cmap_regs);
- if (rbv_cmap_regs)
- iounmap(rbv_cmap_regs);
- if (civic_cmap_regs)
- iounmap(civic_cmap_regs);
- if (csc_cmap_regs)
- iounmap(csc_cmap_regs);
+ iounmap(dafb_cmap_regs);
+ iounmap(v8_brazil_cmap_regs);
+ iounmap(rbv_cmap_regs);
+ iounmap(civic_cmap_regs);
+ iounmap(csc_cmap_regs);
}
static int __init macfb_init(void)
diff --git a/drivers/video/fbdev/offb.c b/drivers/video/fbdev/offb.c
index 43a0a52..5efce99 100644
--- a/drivers/video/fbdev/offb.c
+++ b/drivers/video/fbdev/offb.c
@@ -281,8 +281,7 @@ static int offb_set_par(struct fb_info *info)
static void offb_destroy(struct fb_info *info)
{
- if (info->screen_base)
- iounmap(info->screen_base);
+ iounmap(info->screen_base);
release_mem_region(info->apertures->ranges[0].base, info->apertures->ranges[0].size);
framebuffer_release(info);
}
diff --git a/drivers/video/fbdev/pvr2fb.c b/drivers/video/fbdev/pvr2fb.c
index 7c74f58..7aa4ef1 100644
--- a/drivers/video/fbdev/pvr2fb.c
+++ b/drivers/video/fbdev/pvr2fb.c
@@ -841,8 +841,7 @@ static int pvr2fb_common_init(void)
return 0;
out_err:
- if (fb_info->screen_base)
- iounmap(fb_info->screen_base);
+ iounmap(fb_info->screen_base);
if (par->mmio_base)
iounmap((void *)par->mmio_base);
diff --git a/drivers/video/fbdev/s1d13xxxfb.c b/drivers/video/fbdev/s1d13xxxfb.c
index 83433cb..dff38b7 100644
--- a/drivers/video/fbdev/s1d13xxxfb.c
+++ b/drivers/video/fbdev/s1d13xxxfb.c
@@ -750,8 +750,7 @@ s1d13xxxfb_remove(struct platform_device *pdev)
fb_dealloc_cmap(&info->cmap);
- if (info->screen_base)
- iounmap(info->screen_base);
+ iounmap(info->screen_base);
framebuffer_release(info);
}
diff --git a/drivers/video/fbdev/s3fb.c b/drivers/video/fbdev/s3fb.c
index f0ae61a..3d9d45f 100644
--- a/drivers/video/fbdev/s3fb.c
+++ b/drivers/video/fbdev/s3fb.c
@@ -1382,8 +1382,7 @@ err_find_mode:
#ifdef CONFIG_FB_S3_DDC
if (par->ddc_registered)
i2c_del_adapter(&par->ddc_adapter);
- if (par->mmio)
- iounmap(par->mmio);
+ iounmap(par->mmio);
#endif
pci_iounmap(dev, info->screen_base);
err_iomap:
@@ -1419,8 +1418,7 @@ static void s3_pci_remove(struct pci_dev *dev)
#ifdef CONFIG_FB_S3_DDC
if (par->ddc_registered)
i2c_del_adapter(&par->ddc_adapter);
- if (par->mmio)
- iounmap(par->mmio);
+ iounmap(par->mmio);
#endif
pci_iounmap(dev, info->screen_base);
diff --git a/drivers/video/fbdev/sh_mobile_hdmi.c b/drivers/video/fbdev/sh_mobile_hdmi.c
index 7c72a3f..2a7187d 100644
--- a/drivers/video/fbdev/sh_mobile_hdmi.c
+++ b/drivers/video/fbdev/sh_mobile_hdmi.c
@@ -1397,8 +1397,7 @@ static int __init sh_hdmi_probe(struct platform_device *pdev)
ecodec:
free_irq(irq, hdmi);
ereqirq:
- if (hdmi->htop1)
- iounmap(hdmi->htop1);
+ iounmap(hdmi->htop1);
emap_htop1:
pm_runtime_put(&pdev->dev);
pm_runtime_disable(&pdev->dev);
@@ -1428,8 +1427,7 @@ static int __exit sh_hdmi_remove(struct platform_device *pdev)
pm_runtime_disable(&pdev->dev);
clk_disable_unprepare(hdmi->hdmi_clk);
clk_put(hdmi->hdmi_clk);
- if (hdmi->htop1)
- iounmap(hdmi->htop1);
+ iounmap(hdmi->htop1);
iounmap(hdmi->base);
release_mem_region(res->start, resource_size(res));
diff --git a/drivers/video/fbdev/sh_mobile_lcdcfb.c b/drivers/video/fbdev/sh_mobile_lcdcfb.c
index d3013cd..4f9a25b 100644
--- a/drivers/video/fbdev/sh_mobile_lcdcfb.c
+++ b/drivers/video/fbdev/sh_mobile_lcdcfb.c
@@ -2489,8 +2489,7 @@ static int sh_mobile_lcdc_remove(struct platform_device *pdev)
clk_put(priv->dot_clk);
}
- if (priv->base)
- iounmap(priv->base);
+ iounmap(priv->base);
if (priv->irq)
free_irq(priv->irq, priv);
diff --git a/drivers/video/fbdev/simplefb.c b/drivers/video/fbdev/simplefb.c
index 92cac80..40e6b33 100644
--- a/drivers/video/fbdev/simplefb.c
+++ b/drivers/video/fbdev/simplefb.c
@@ -72,8 +72,7 @@ static int simplefb_setcolreg(u_int regno, u_int red, u_int green, u_int blue,
static void simplefb_destroy(struct fb_info *info)
{
- if (info->screen_base)
- iounmap(info->screen_base);
+ iounmap(info->screen_base);
}
static struct fb_ops simplefb_ops = {
diff --git a/drivers/video/fbdev/stifb.c b/drivers/video/fbdev/stifb.c
index 86621fa..ea12305 100644
--- a/drivers/video/fbdev/stifb.c
+++ b/drivers/video/fbdev/stifb.c
@@ -1374,8 +1374,7 @@ stifb_cleanup(void)
unregister_framebuffer(sti->info);
release_mem_region(info->fix.mmio_start, info->fix.mmio_len);
release_mem_region(info->fix.smem_start, info->fix.smem_len);
- if (info->screen_base)
- iounmap(info->screen_base);
+ iounmap(info->screen_base);
fb_dealloc_cmap(&info->cmap);
framebuffer_release(info);
}
diff --git a/drivers/video/fbdev/tdfxfb.c b/drivers/video/fbdev/tdfxfb.c
index f761fe3..69d4062 100644
--- a/drivers/video/fbdev/tdfxfb.c
+++ b/drivers/video/fbdev/tdfxfb.c
@@ -1572,15 +1572,13 @@ out_err_iobase:
release_region(pci_resource_start(pdev, 2),
pci_resource_len(pdev, 2));
out_err_screenbase:
- if (info->screen_base)
- iounmap(info->screen_base);
+ iounmap(info->screen_base);
release_mem_region(info->fix.smem_start, pci_resource_len(pdev, 1));
out_err_regbase:
/*
* Cleanup after anything that was remapped/allocated.
*/
- if (default_par->regbase_virt)
- iounmap(default_par->regbase_virt);
+ iounmap(default_par->regbase_virt);
release_mem_region(info->fix.mmio_start, info->fix.mmio_len);
out_err:
framebuffer_release(info);
diff --git a/drivers/video/fbdev/tgafb.c b/drivers/video/fbdev/tgafb.c
index 65ba992..b6fb7e8 100644
--- a/drivers/video/fbdev/tgafb.c
+++ b/drivers/video/fbdev/tgafb.c
@@ -1520,8 +1520,7 @@ static int tgafb_register(struct device *dev)
err2:
fb_dealloc_cmap(&info->cmap);
err1:
- if (mem_base)
- iounmap(mem_base);
+ iounmap(mem_base);
release_mem_region(bar0_start, bar0_len);
err0:
framebuffer_release(info);
diff --git a/drivers/video/fbdev/tridentfb.c b/drivers/video/fbdev/tridentfb.c
index 7ed9a22..71567401 100644
--- a/drivers/video/fbdev/tridentfb.c
+++ b/drivers/video/fbdev/tridentfb.c
@@ -1531,13 +1531,11 @@ static int trident_pci_probe(struct pci_dev *dev,
out_unmap2:
kfree(info->pixmap.addr);
- if (info->screen_base)
- iounmap(info->screen_base);
+ iounmap(info->screen_base);
release_mem_region(tridentfb_fix.smem_start, tridentfb_fix.smem_len);
disable_mmio(info->par);
out_unmap1:
- if (default_par->io_virt)
- iounmap(default_par->io_virt);
+ iounmap(default_par->io_virt);
release_mem_region(tridentfb_fix.mmio_start, tridentfb_fix.mmio_len);
framebuffer_release(info);
return err;
diff --git a/drivers/video/fbdev/valkyriefb.c b/drivers/video/fbdev/valkyriefb.c
index 275fb98..2a9213b 100644
--- a/drivers/video/fbdev/valkyriefb.c
+++ b/drivers/video/fbdev/valkyriefb.c
@@ -400,12 +400,9 @@ int __init valkyriefb_init(void)
out_cmap_free:
fb_dealloc_cmap(&p->info.cmap);
out_free:
- if (p->frame_buffer)
- iounmap(p->frame_buffer);
- if (p->cmap_regs)
- iounmap(p->cmap_regs);
- if (p->valkyrie_regs)
- iounmap(p->valkyrie_regs);
+ iounmap(p->frame_buffer);
+ iounmap(p->cmap_regs);
+ iounmap(p->valkyrie_regs);
kfree(p);
return err;
}
diff --git a/drivers/video/fbdev/vesafb.c b/drivers/video/fbdev/vesafb.c
index d79a0ac..693d18e 100644
--- a/drivers/video/fbdev/vesafb.c
+++ b/drivers/video/fbdev/vesafb.c
@@ -176,8 +176,7 @@ static int vesafb_setcolreg(unsigned regno, unsigned red, unsigned green,
static void vesafb_destroy(struct fb_info *info)
{
fb_dealloc_cmap(&info->cmap);
- if (info->screen_base)
- iounmap(info->screen_base);
+ iounmap(info->screen_base);
release_mem_region(info->apertures->ranges[0].base, info->apertures->ranges[0].size);
}
@@ -492,8 +491,7 @@ static int vesafb_probe(struct platform_device *dev)
fb_info(info, "%s frame buffer device\n", info->fix.id);
return 0;
err:
- if (info->screen_base)
- iounmap(info->screen_base);
+ iounmap(info->screen_base);
framebuffer_release(info);
release_mem_region(vesafb_fix.smem_start, size_total);
return err;
diff --git a/drivers/video/fbdev/w100fb.c b/drivers/video/fbdev/w100fb.c
index 10951c8..aeb53eb 100644
--- a/drivers/video/fbdev/w100fb.c
+++ b/drivers/video/fbdev/w100fb.c
@@ -770,12 +770,9 @@ out:
fb_dealloc_cmap(&info->cmap);
kfree(info->pseudo_palette);
}
- if (remapped_fbuf != NULL)
- iounmap(remapped_fbuf);
- if (remapped_regs != NULL)
- iounmap(remapped_regs);
- if (remapped_base != NULL)
- iounmap(remapped_base);
+ iounmap(remapped_fbuf);
+ iounmap(remapped_regs);
+ iounmap(remapped_base);
if (info)
framebuffer_release(info);
return err;
--
2.2.2
^ permalink raw reply related [flat|nested] 38+ messages in thread
* video: One function call less in tdfxfb_probe() after error detection
2015-01-19 17:54 ` [PATCH 0/9] video: fbdev: Deletion of some unnecessary checks SF Markus Elfring
2015-01-19 18:00 ` [PATCH 1/9] video: Deletion of checks before the function call "iounmap" SF Markus Elfring
@ 2015-01-19 18:25 ` SF Markus Elfring
2015-01-19 18:30 ` [PATCH 3/9] video: One function call less in vesafb_probe() after, " SF Markus Elfring
` (6 subsequent siblings)
8 siblings, 0 replies; 38+ messages in thread
From: SF Markus Elfring @ 2015-01-19 18:25 UTC (permalink / raw)
To: Jean-Christophe Plagniol-Villard, Tomi Valkeinen, linux-fbdev
Cc: LKML, kernel-janitors, Julia Lawall
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Sun, 18 Jan 2015 23:30:41 +0100
The iounmap() function could be called in two cases by the tdfxfb_probe()
function during error handling even if the passed data structure element
contained still a null pointer.
This implementation detail could be improved by adjustments for jump labels.
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
drivers/video/fbdev/tdfxfb.c | 16 +++++++++-------
1 file changed, 9 insertions(+), 7 deletions(-)
diff --git a/drivers/video/fbdev/tdfxfb.c b/drivers/video/fbdev/tdfxfb.c
index 69d4062..c280a3b 100644
--- a/drivers/video/fbdev/tdfxfb.c
+++ b/drivers/video/fbdev/tdfxfb.c
@@ -1438,20 +1438,20 @@ static int tdfxfb_probe(struct pci_dev *pdev, const struct pci_device_id *id)
if (!default_par->regbase_virt) {
printk(KERN_ERR "fb: Can't remap %s register area.\n",
info->fix.id);
- goto out_err_regbase;
+ goto release_memory_region_regbase;
}
info->fix.smem_start = pci_resource_start(pdev, 1);
info->fix.smem_len = do_lfb_size(default_par, pdev->device);
if (!info->fix.smem_len) {
printk(KERN_ERR "fb: Can't count %s memory.\n", info->fix.id);
- goto out_err_regbase;
+ goto io_unmap_regbase;
}
if (!request_mem_region(info->fix.smem_start,
pci_resource_len(pdev, 1), "tdfx smem")) {
printk(KERN_ERR "tdfxfb: Can't reserve smem\n");
- goto out_err_regbase;
+ goto io_unmap_regbase;
}
info->screen_base = ioremap_nocache(info->fix.smem_start,
@@ -1459,7 +1459,7 @@ static int tdfxfb_probe(struct pci_dev *pdev, const struct pci_device_id *id)
if (!info->screen_base) {
printk(KERN_ERR "fb: Can't remap %s framebuffer.\n",
info->fix.id);
- goto out_err_screenbase;
+ goto release_memory_region_screenbase;
}
default_par->iobase = pci_resource_start(pdev, 2);
@@ -1467,7 +1467,7 @@ static int tdfxfb_probe(struct pci_dev *pdev, const struct pci_device_id *id)
if (!request_region(pci_resource_start(pdev, 2),
pci_resource_len(pdev, 2), "tdfx iobase")) {
printk(KERN_ERR "tdfxfb: Can't reserve iobase\n");
- goto out_err_screenbase;
+ goto io_unmap_screenbase;
}
printk(KERN_INFO "fb: %s memory = %dK\n", info->fix.id,
@@ -1571,14 +1571,16 @@ out_err_iobase:
info->fix.smem_len);
release_region(pci_resource_start(pdev, 2),
pci_resource_len(pdev, 2));
-out_err_screenbase:
+io_unmap_screenbase:
iounmap(info->screen_base);
+release_memory_region_screenbase:
release_mem_region(info->fix.smem_start, pci_resource_len(pdev, 1));
-out_err_regbase:
+io_unmap_regbase:
/*
* Cleanup after anything that was remapped/allocated.
*/
iounmap(default_par->regbase_virt);
+release_memory_region_regbase:
release_mem_region(info->fix.mmio_start, info->fix.mmio_len);
out_err:
framebuffer_release(info);
--
2.2.2
^ permalink raw reply related [flat|nested] 38+ messages in thread
* [PATCH 3/9] video: One function call less in vesafb_probe() after, error detection
2015-01-19 17:54 ` [PATCH 0/9] video: fbdev: Deletion of some unnecessary checks SF Markus Elfring
2015-01-19 18:00 ` [PATCH 1/9] video: Deletion of checks before the function call "iounmap" SF Markus Elfring
2015-01-19 18:25 ` video: One function call less in tdfxfb_probe() after error detection SF Markus Elfring
@ 2015-01-19 18:30 ` SF Markus Elfring
2015-01-19 18:34 ` [PATCH 4/9] video: Add check for return value of ioremap() in cirrusfb_pci_register() SF Markus Elfring
` (5 subsequent siblings)
8 siblings, 0 replies; 38+ messages in thread
From: SF Markus Elfring @ 2015-01-19 18:30 UTC (permalink / raw)
To: Jean-Christophe Plagniol-Villard, Tomi Valkeinen, linux-fbdev
Cc: LKML, kernel-janitors, Julia Lawall
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Mon, 19 Jan 2015 11:30:33 +0100
The iounmap() function could be called in two cases by the vesafb_probe()
function during error handling even if the passed data structure element
contained still a null pointer.
This implementation detail could be improved by adjustments for jump labels.
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
drivers/video/fbdev/vesafb.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/drivers/video/fbdev/vesafb.c b/drivers/video/fbdev/vesafb.c
index 693d18e..de7cad0 100644
--- a/drivers/video/fbdev/vesafb.c
+++ b/drivers/video/fbdev/vesafb.c
@@ -303,7 +303,7 @@ static int vesafb_probe(struct platform_device *dev)
info->apertures = alloc_apertures(1);
if (!info->apertures) {
err = -ENOMEM;
- goto err;
+ goto release_framebuffer;
}
info->apertures->ranges[0].base = screen_info.lfb_base;
info->apertures->ranges[0].size = size_total;
@@ -462,7 +462,7 @@ static int vesafb_probe(struct platform_device *dev)
"vesafb: abort, cannot ioremap video memory 0x%x @ 0x%lx\n",
vesafb_fix.smem_len, vesafb_fix.smem_start);
err = -EIO;
- goto err;
+ goto release_framebuffer;
}
printk(KERN_INFO "vesafb: framebuffer at 0x%lx, mapped to 0x%p, "
@@ -492,6 +492,7 @@ static int vesafb_probe(struct platform_device *dev)
return 0;
err:
iounmap(info->screen_base);
+release_framebuffer:
framebuffer_release(info);
release_mem_region(vesafb_fix.smem_start, size_total);
return err;
--
2.2.2
^ permalink raw reply related [flat|nested] 38+ messages in thread
* [PATCH 4/9] video: Add check for return value of ioremap() in cirrusfb_pci_register()
2015-01-19 17:54 ` [PATCH 0/9] video: fbdev: Deletion of some unnecessary checks SF Markus Elfring
` (2 preceding siblings ...)
2015-01-19 18:30 ` [PATCH 3/9] video: One function call less in vesafb_probe() after, " SF Markus Elfring
@ 2015-01-19 18:34 ` SF Markus Elfring
2015-01-19 18:38 ` [PATCH 5/9] video: Less function calls in trident_pci_probe() after error detection SF Markus Elfring
` (4 subsequent siblings)
8 siblings, 0 replies; 38+ messages in thread
From: SF Markus Elfring @ 2015-01-19 18:34 UTC (permalink / raw)
To: Jean-Christophe Plagniol-Villard, Tomi Valkeinen, linux-fbdev
Cc: LKML, kernel-janitors, Julia Lawall
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Mon, 19 Jan 2015 13:18:50 +0100
The return value from a call of the ioremap() function was not checked
by the implementation of the cirrusfb_pci_register() function.
Let us complete the corresponding error detection and exception handling
at this source code place.
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
drivers/video/fbdev/cirrusfb.c | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/drivers/video/fbdev/cirrusfb.c b/drivers/video/fbdev/cirrusfb.c
index d8b3359..aa4050c 100644
--- a/drivers/video/fbdev/cirrusfb.c
+++ b/drivers/video/fbdev/cirrusfb.c
@@ -2111,6 +2111,10 @@ static int cirrusfb_pci_register(struct pci_dev *pdev,
/* FIXME: this forces VGA. alternatives? */
cinfo->regbase = NULL;
cinfo->laguna_mmio = ioremap(info->fix.mmio_start, 0x1000);
+ if (!cinfo->laguna_mmio) {
+ ret = -EIO;
+ goto err_release_fb;
+ }
dev_dbg(info->device, "Board address: 0x%lx, register address: 0x%lx\n",
board_addr, info->fix.mmio_start);
@@ -2122,7 +2126,7 @@ static int cirrusfb_pci_register(struct pci_dev *pdev,
if (ret < 0) {
dev_err(info->device, "cannot reserve region 0x%lx, abort\n",
board_addr);
- goto err_release_fb;
+ goto io_unmap_laguna;
}
#if 0 /* if the system didn't claim this region, we would... */
if (!request_mem_region(0xA0000, 65535, "cirrusfb")) {
@@ -2163,8 +2167,9 @@ err_release_legacy:
err_release_regions:
#endif
pci_release_regions(pdev);
-err_release_fb:
+io_unmap_laguna:
iounmap(cinfo->laguna_mmio);
+err_release_fb:
framebuffer_release(info);
err_out:
return ret;
--
2.2.2
^ permalink raw reply related [flat|nested] 38+ messages in thread
* [PATCH 5/9] video: Less function calls in trident_pci_probe() after error detection
2015-01-19 17:54 ` [PATCH 0/9] video: fbdev: Deletion of some unnecessary checks SF Markus Elfring
` (3 preceding siblings ...)
2015-01-19 18:34 ` [PATCH 4/9] video: Add check for return value of ioremap() in cirrusfb_pci_register() SF Markus Elfring
@ 2015-01-19 18:38 ` SF Markus Elfring
2015-01-19 18:41 ` [PATCH 6/9] video: One function call less in pvr2fb_common_init() " SF Markus Elfring
` (3 subsequent siblings)
8 siblings, 0 replies; 38+ messages in thread
From: SF Markus Elfring @ 2015-01-19 18:38 UTC (permalink / raw)
To: Jean-Christophe Plagniol-Villard, Tomi Valkeinen, linux-fbdev
Cc: LKML, kernel-janitors, Julia Lawall
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Mon, 19 Jan 2015 14:18:47 +0100
The functions "iounmap" and "kfree" could be called in a few cases by the
trident_pci_probe() function during error handling even if the passed data
structure element contained still a null pointer.
This implementation detail could be improved by adjustments for jump labels.
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
drivers/video/fbdev/tridentfb.c | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/drivers/video/fbdev/tridentfb.c b/drivers/video/fbdev/tridentfb.c
index 71567401..86d4733 100644
--- a/drivers/video/fbdev/tridentfb.c
+++ b/drivers/video/fbdev/tridentfb.c
@@ -1436,7 +1436,7 @@ static int trident_pci_probe(struct pci_dev *dev,
if (!default_par->io_virt) {
debug("ioremap failed\n");
err = -1;
- goto out_unmap1;
+ goto release_memory_region_mmio;
}
enable_mmio(default_par);
@@ -1459,7 +1459,7 @@ static int trident_pci_probe(struct pci_dev *dev,
if (!info->screen_base) {
debug("ioremap failed\n");
err = -1;
- goto out_unmap2;
+ goto release_memory_region_smem;
}
default_par->flatpanel = is_flatpanel(default_par);
@@ -1485,7 +1485,7 @@ static int trident_pci_probe(struct pci_dev *dev,
info->pixmap.addr = kmalloc(4096, GFP_KERNEL);
if (!info->pixmap.addr) {
err = -ENOMEM;
- goto out_unmap2;
+ goto io_unmap_screenbase;
}
info->pixmap.size = 4096;
@@ -1531,11 +1531,14 @@ static int trident_pci_probe(struct pci_dev *dev,
out_unmap2:
kfree(info->pixmap.addr);
+io_unmap_screenbase:
iounmap(info->screen_base);
+release_memory_region_smem:
release_mem_region(tridentfb_fix.smem_start, tridentfb_fix.smem_len);
disable_mmio(info->par);
out_unmap1:
iounmap(default_par->io_virt);
+release_memory_region_mmio:
release_mem_region(tridentfb_fix.mmio_start, tridentfb_fix.mmio_len);
framebuffer_release(info);
return err;
--
2.2.2
^ permalink raw reply related [flat|nested] 38+ messages in thread
* [PATCH 6/9] video: One function call less in pvr2fb_common_init() after error detection
2015-01-19 17:54 ` [PATCH 0/9] video: fbdev: Deletion of some unnecessary checks SF Markus Elfring
` (4 preceding siblings ...)
2015-01-19 18:38 ` [PATCH 5/9] video: Less function calls in trident_pci_probe() after error detection SF Markus Elfring
@ 2015-01-19 18:41 ` SF Markus Elfring
2015-01-19 18:43 ` [PATCH 7/9] video: One function call less in tgafb_register() after, " SF Markus Elfring
` (2 subsequent siblings)
8 siblings, 0 replies; 38+ messages in thread
From: SF Markus Elfring @ 2015-01-19 18:41 UTC (permalink / raw)
To: Jean-Christophe Plagniol-Villard, Tomi Valkeinen, linux-fbdev
Cc: LKML, kernel-janitors, Julia Lawall
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Mon, 19 Jan 2015 14:50:44 +0100
The iounmap() function could be called in two cases by the pvr2fb_common_init()
function during error handling even if the passed data structure element
contained still a null pointer.
This implementation detail could be improved by adjustments for jump labels.
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
drivers/video/fbdev/pvr2fb.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/drivers/video/fbdev/pvr2fb.c b/drivers/video/fbdev/pvr2fb.c
index 7aa4ef1..9fb8bbf 100644
--- a/drivers/video/fbdev/pvr2fb.c
+++ b/drivers/video/fbdev/pvr2fb.c
@@ -773,14 +773,14 @@ static int pvr2fb_common_init(void)
if (!fb_info->screen_base) {
printk(KERN_ERR "pvr2fb: Failed to remap smem space\n");
- goto out_err;
+ return -ENXIO;
}
par->mmio_base = (unsigned long)ioremap_nocache(pvr2_fix.mmio_start,
pvr2_fix.mmio_len);
if (!par->mmio_base) {
printk(KERN_ERR "pvr2fb: Failed to remap mmio space\n");
- goto out_err;
+ goto io_unmap_screen;
}
fb_memset(fb_info->screen_base, 0, pvr2_fix.smem_len);
@@ -807,7 +807,7 @@ static int pvr2fb_common_init(void)
fb_alloc_cmap(&fb_info->cmap, 256, 0);
if (register_framebuffer(fb_info) < 0)
- goto out_err;
+ goto io_unmap_mmio;
/*Must write PIXDEPTH to register before anything is displayed - so force init */
pvr2_init_display(fb_info);
@@ -840,10 +840,10 @@ static int pvr2fb_common_init(void)
return 0;
-out_err:
+io_unmap_mmio:
+ iounmap((void *)par->mmio_base);
+io_unmap_screen:
iounmap(fb_info->screen_base);
- if (par->mmio_base)
- iounmap((void *)par->mmio_base);
return -ENXIO;
}
--
2.2.2
^ permalink raw reply related [flat|nested] 38+ messages in thread
* [PATCH 7/9] video: One function call less in tgafb_register() after, error detection
2015-01-19 17:54 ` [PATCH 0/9] video: fbdev: Deletion of some unnecessary checks SF Markus Elfring
` (5 preceding siblings ...)
2015-01-19 18:41 ` [PATCH 6/9] video: One function call less in pvr2fb_common_init() " SF Markus Elfring
@ 2015-01-19 18:43 ` SF Markus Elfring
2015-01-19 18:46 ` [PATCH 8/9] video: Less function calls in valkyriefb_init() after " SF Markus Elfring
2015-01-19 18:49 ` [PATCH 9/9] video: Less function calls in w100fb_probe() " SF Markus Elfring
8 siblings, 0 replies; 38+ messages in thread
From: SF Markus Elfring @ 2015-01-19 18:43 UTC (permalink / raw)
To: Jean-Christophe Plagniol-Villard, Tomi Valkeinen, linux-fbdev
Cc: LKML, kernel-janitors, Julia Lawall
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Mon, 19 Jan 2015 15:30:45 +0100
The iounmap() function could be called in one case by the tgafb_register()
function during error handling even if the passed variable "mem_base"
contained still a null pointer.
This implementation detail could be improved by adjustments for jump labels
(according also to current Linux coding style).
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
drivers/video/fbdev/tgafb.c | 17 +++++++++--------
1 file changed, 9 insertions(+), 8 deletions(-)
diff --git a/drivers/video/fbdev/tgafb.c b/drivers/video/fbdev/tgafb.c
index b6fb7e8..a3cd0ef 100644
--- a/drivers/video/fbdev/tgafb.c
+++ b/drivers/video/fbdev/tgafb.c
@@ -1436,14 +1436,14 @@ static int tgafb_register(struct device *dev)
}
if (!request_mem_region (bar0_start, bar0_len, "tgafb")) {
printk(KERN_ERR "tgafb: cannot reserve FB region\n");
- goto err0;
+ goto release_framebuffer;
}
/* Map the framebuffer. */
mem_base = ioremap_nocache(bar0_start, bar0_len);
if (!mem_base) {
printk(KERN_ERR "tgafb: Cannot map MMIO\n");
- goto err1;
+ goto release_memory_region;
}
/* Grab info about the card. */
@@ -1484,13 +1484,13 @@ static int tgafb_register(struct device *dev)
if (ret = 0 || ret = 4) {
printk(KERN_ERR "tgafb: Could not find valid video mode\n");
ret = -EINVAL;
- goto err1;
+ goto io_unmap;
}
if (fb_alloc_cmap(&info->cmap, 256, 0)) {
printk(KERN_ERR "tgafb: Could not allocate color map\n");
ret = -ENOMEM;
- goto err1;
+ goto io_unmap;
}
tgafb_set_par(info);
@@ -1498,7 +1498,7 @@ static int tgafb_register(struct device *dev)
if (register_framebuffer(info) < 0) {
printk(KERN_ERR "tgafb: Could not register framebuffer\n");
ret = -EINVAL;
- goto err2;
+ goto dealloc_cmap;
}
if (tga_bus_pci) {
@@ -1517,12 +1517,13 @@ static int tgafb_register(struct device *dev)
return 0;
- err2:
+dealloc_cmap:
fb_dealloc_cmap(&info->cmap);
- err1:
+io_unmap:
iounmap(mem_base);
+release_memory_region:
release_mem_region(bar0_start, bar0_len);
- err0:
+release_framebuffer:
framebuffer_release(info);
return ret;
}
--
2.2.2
^ permalink raw reply related [flat|nested] 38+ messages in thread
* [PATCH 8/9] video: Less function calls in valkyriefb_init() after error detection
2015-01-19 17:54 ` [PATCH 0/9] video: fbdev: Deletion of some unnecessary checks SF Markus Elfring
` (6 preceding siblings ...)
2015-01-19 18:43 ` [PATCH 7/9] video: One function call less in tgafb_register() after, " SF Markus Elfring
@ 2015-01-19 18:46 ` SF Markus Elfring
2015-01-19 18:49 ` [PATCH 9/9] video: Less function calls in w100fb_probe() " SF Markus Elfring
8 siblings, 0 replies; 38+ messages in thread
From: SF Markus Elfring @ 2015-01-19 18:46 UTC (permalink / raw)
To: Jean-Christophe Plagniol-Villard, Tomi Valkeinen, linux-fbdev
Cc: LKML, kernel-janitors, Julia Lawall
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Mon, 19 Jan 2015 17:01:25 +0100
The iounmap() function could be called in three cases by the valkyriefb_init()
function during error handling even if the passed data structure element
contained still a null pointer.
This implementation detail could be improved by adjustments for jump labels
(according also to current Linux coding style) and error messages.
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
drivers/video/fbdev/valkyriefb.c | 32 +++++++++++++++++++++-----------
1 file changed, 21 insertions(+), 11 deletions(-)
diff --git a/drivers/video/fbdev/valkyriefb.c b/drivers/video/fbdev/valkyriefb.c
index 2a9213b..a81a0f1 100644
--- a/drivers/video/fbdev/valkyriefb.c
+++ b/drivers/video/fbdev/valkyriefb.c
@@ -369,40 +369,50 @@ int __init valkyriefb_init(void)
}
p->total_vram = 0x100000;
p->frame_buffer_phys = frame_buffer_phys;
+ err = -ENOMEM;
p->frame_buffer = __ioremap(frame_buffer_phys, p->total_vram, flags);
+ if (p->frame_buffer = NULL) {
+ pr_err("%s: %s failed\n", __func__, "Frame buffer mapping");
+ goto free_memory;
+ }
p->cmap_regs_phys = cmap_regs_phys;
p->cmap_regs = ioremap(p->cmap_regs_phys, 0x1000);
+ if (p->cmap_regs = NULL) {
+ pr_err("%s: %s failed\n", __func__, "cmap");
+ goto io_unmap_framebuffer;
+ }
p->valkyrie_regs_phys = cmap_regs_phys+0x6000;
p->valkyrie_regs = ioremap(p->valkyrie_regs_phys, 0x1000);
- err = -ENOMEM;
- if (p->frame_buffer = NULL || p->cmap_regs = NULL
- || p->valkyrie_regs = NULL) {
- printk(KERN_ERR "valkyriefb: couldn't map resources\n");
- goto out_free;
+ if (p->valkyrie_regs = NULL) {
+ pr_err("%s: %s failed\n", __func__, "ioremap");
+ goto io_unmap_cmap;
}
valkyrie_choose_mode(p);
mac_vmode_to_var(default_vmode, default_cmode, &p->info.var);
err = valkyrie_init_info(&p->info, p);
if (err < 0)
- goto out_free;
+ goto io_unmap_valkyrie;
valkyrie_init_fix(&p->info.fix, p);
if (valkyriefb_set_par(&p->info))
/* "can't happen" */
printk(KERN_ERR "valkyriefb: can't set default video mode\n");
if ((err = register_framebuffer(&p->info)) != 0)
- goto out_cmap_free;
+ goto dealloc_cmap;
fb_info(&p->info, "valkyrie frame buffer device\n");
return 0;
- out_cmap_free:
+dealloc_cmap:
fb_dealloc_cmap(&p->info.cmap);
- out_free:
- iounmap(p->frame_buffer);
- iounmap(p->cmap_regs);
+io_unmap_valkyrie:
iounmap(p->valkyrie_regs);
+io_unmap_cmap:
+ iounmap(p->cmap_regs);
+io_unmap_framebuffer:
+ iounmap(p->frame_buffer);
+free_memory:
kfree(p);
return err;
}
--
2.2.2
^ permalink raw reply related [flat|nested] 38+ messages in thread
* [PATCH 9/9] video: Less function calls in w100fb_probe() after error detection
2015-01-19 17:54 ` [PATCH 0/9] video: fbdev: Deletion of some unnecessary checks SF Markus Elfring
` (7 preceding siblings ...)
2015-01-19 18:46 ` [PATCH 8/9] video: Less function calls in valkyriefb_init() after " SF Markus Elfring
@ 2015-01-19 18:49 ` SF Markus Elfring
8 siblings, 0 replies; 38+ messages in thread
From: SF Markus Elfring @ 2015-01-19 18:49 UTC (permalink / raw)
To: Jean-Christophe Plagniol-Villard, Tomi Valkeinen, linux-fbdev
Cc: LKML, kernel-janitors, Julia Lawall
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Mon, 19 Jan 2015 17:56:11 +0100
The iounmap() function could be called in three cases by the w100fb_probe()
function during error handling even if the passed data structure element
contained still a null pointer.
* This implementation detail could be improved by adjustments for
jump labels.
* Let us also delete two unnecessary null pointer checks for the
variable "info".
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
drivers/video/fbdev/w100fb.c | 31 +++++++++++++++++--------------
1 file changed, 17 insertions(+), 14 deletions(-)
diff --git a/drivers/video/fbdev/w100fb.c b/drivers/video/fbdev/w100fb.c
index aeb53eb..67ddc57 100644
--- a/drivers/video/fbdev/w100fb.c
+++ b/drivers/video/fbdev/w100fb.c
@@ -645,12 +645,12 @@ int w100fb_probe(struct platform_device *pdev)
/* Remap the chip base address */
remapped_base = ioremap_nocache(mem->start+W100_CFG_BASE, W100_CFG_LEN);
if (remapped_base = NULL)
- goto out;
+ goto exit;
/* Map the register space */
remapped_regs = ioremap_nocache(mem->start+W100_REG_BASE, W100_REG_LEN);
if (remapped_regs = NULL)
- goto out;
+ goto io_unmap_base;
/* Identify the chip */
printk("Found ");
@@ -662,19 +662,19 @@ int w100fb_probe(struct platform_device *pdev)
default:
printk("Unknown imageon chip ID\n");
err = -ENODEV;
- goto out;
+ goto io_unmap_regs;
}
printk(" at 0x%08lx.\n", (unsigned long) mem->start+W100_CFG_BASE);
/* Remap the framebuffer */
remapped_fbuf = ioremap_nocache(mem->start+MEM_WINDOW_BASE, MEM_WINDOW_SIZE);
if (remapped_fbuf = NULL)
- goto out;
+ goto io_unmap_regs;
info=framebuffer_alloc(sizeof(struct w100fb_par), &pdev->dev);
if (!info) {
err = -ENOMEM;
- goto out;
+ goto io_unmap_framebuffer;
}
par = info->par;
@@ -690,13 +690,13 @@ int w100fb_probe(struct platform_device *pdev)
if (!par->pll_table) {
printk(KERN_ERR "No matching Xtal definition found\n");
err = -EINVAL;
- goto out;
+ goto release_framebuffer;
}
info->pseudo_palette = kmalloc(sizeof (u32) * MAX_PALETTES, GFP_KERNEL);
if (!info->pseudo_palette) {
err = -ENOMEM;
- goto out;
+ goto release_framebuffer;
}
info->fbops = &w100fb_ops;
@@ -716,7 +716,7 @@ int w100fb_probe(struct platform_device *pdev)
if (fb_alloc_cmap(&info->cmap, 256, 0) < 0) {
err = -ENOMEM;
- goto out;
+ goto free_palette;
}
par->mode = &inf->modelist[0];
@@ -766,15 +766,18 @@ int w100fb_probe(struct platform_device *pdev)
fb_info(info, "%s frame buffer device\n", info->fix.id);
return 0;
out:
- if (info) {
- fb_dealloc_cmap(&info->cmap);
- kfree(info->pseudo_palette);
- }
+ fb_dealloc_cmap(&info->cmap);
+free_palette:
+ kfree(info->pseudo_palette);
+release_framebuffer:
+ framebuffer_release(info);
+io_unmap_framebuffer:
iounmap(remapped_fbuf);
+io_unmap_regs:
iounmap(remapped_regs);
+io_unmap_base:
iounmap(remapped_base);
- if (info)
- framebuffer_release(info);
+exit:
return err;
}
--
2.2.2
^ permalink raw reply related [flat|nested] 38+ messages in thread
* [PATCH] au1100fb: Delete unnecessary checks before two function calls
[not found] ` <5317A59D.4@users.sourceforge.net>
` (11 preceding siblings ...)
2015-01-19 17:54 ` [PATCH 0/9] video: fbdev: Deletion of some unnecessary checks SF Markus Elfring
@ 2015-02-05 13:14 ` SF Markus Elfring
2015-02-05 13:41 ` Dan Carpenter
2015-02-21 13:26 ` [PATCH] video: fbdev-SIS: Deletion of unnecessary checks before three " SF Markus Elfring
` (2 subsequent siblings)
15 siblings, 1 reply; 38+ messages in thread
From: SF Markus Elfring @ 2015-02-05 13:14 UTC (permalink / raw)
To: Jean-Christophe Plagniol-Villard, Tomi Valkeinen, linux-fbdev
Cc: LKML, kernel-janitors, Julia Lawall
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Thu, 5 Feb 2015 14:10:21 +0100
The functions clk_enable() and clk_disable() test whether their argument
is NULL and then return immediately. Thus the test around the calls
is not needed.
This issue was detected by using the Coccinelle software.
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
drivers/video/fbdev/au1100fb.c | 10 ++--------
1 file changed, 2 insertions(+), 8 deletions(-)
diff --git a/drivers/video/fbdev/au1100fb.c b/drivers/video/fbdev/au1100fb.c
index 5956018..47ee023 100644
--- a/drivers/video/fbdev/au1100fb.c
+++ b/drivers/video/fbdev/au1100fb.c
@@ -605,11 +605,8 @@ int au1100fb_drv_suspend(struct platform_device *dev, pm_message_t state)
/* Blank the LCD */
au1100fb_fb_blank(VESA_POWERDOWN, &fbdev->info);
- if (fbdev->lcdclk)
- clk_disable(fbdev->lcdclk);
-
+ clk_disable(fbdev->lcdclk);
memcpy(&fbregs, fbdev->regs, sizeof(struct au1100fb_regs));
-
return 0;
}
@@ -621,13 +618,10 @@ int au1100fb_drv_resume(struct platform_device *dev)
return 0;
memcpy(fbdev->regs, &fbregs, sizeof(struct au1100fb_regs));
-
- if (fbdev->lcdclk)
- clk_enable(fbdev->lcdclk);
+ clk_enable(fbdev->lcdclk);
/* Unblank the LCD */
au1100fb_fb_blank(VESA_NO_BLANKING, &fbdev->info);
-
return 0;
}
#else
--
2.2.2
^ permalink raw reply related [flat|nested] 38+ messages in thread
* Re: [PATCH] au1100fb: Delete unnecessary checks before two function calls
2015-02-05 13:14 ` [PATCH] au1100fb: Delete unnecessary checks before two function calls SF Markus Elfring
@ 2015-02-05 13:41 ` Dan Carpenter
2015-02-05 14:20 ` SF Markus Elfring
0 siblings, 1 reply; 38+ messages in thread
From: Dan Carpenter @ 2015-02-05 13:41 UTC (permalink / raw)
To: SF Markus Elfring
Cc: Jean-Christophe Plagniol-Villard, Tomi Valkeinen, linux-fbdev,
LKML, kernel-janitors, Julia Lawall
On Thu, Feb 05, 2015 at 02:14:54PM +0100, SF Markus Elfring wrote:
> From: Markus Elfring <elfring@users.sourceforge.net>
> Date: Thu, 5 Feb 2015 14:10:21 +0100
>
> The functions clk_enable() and clk_disable() test whether their argument
> is NULL and then return immediately.
This isn't true for clk_enable().
"I find it acceptable that some of my update suggestions do not fit
to your quality expectations at the moment." --
https://lkml.org/lkml/2015/1/22/446
It's frustrating that you make the same mistake over and over and you
are fine with doing that. If you make a mistake and you are fixing a
bug, then hopefully you fix more bugs than you introduce. If you make a
mistake and you are doing a cleanup then you are really just introducing
bugs and that's not helpful. I wish you would find something useful to
do instead of sending these patches. :(
regards,
dan carpenter
^ permalink raw reply [flat|nested] 38+ messages in thread
* Re: [PATCH] au1100fb: Delete unnecessary checks before two function calls
2015-02-05 13:41 ` Dan Carpenter
@ 2015-02-05 14:20 ` SF Markus Elfring
2015-02-05 17:18 ` Dan Carpenter
0 siblings, 1 reply; 38+ messages in thread
From: SF Markus Elfring @ 2015-02-05 14:20 UTC (permalink / raw)
To: Dan Carpenter
Cc: Jean-Christophe Plagniol-Villard, Tomi Valkeinen, linux-fbdev,
LKML, kernel-janitors, Julia Lawall
>> The functions clk_enable() and clk_disable() test whether their argument
>> is NULL and then return immediately.
>
> This isn't true for clk_enable().
I stumble on an interesting name space issue once more.
> It's frustrating that you make the same mistake over and over
> and you are fine with doing that.
I admit that there can be also risks with my update suggestions
in similar ways to contributions from other software developers.
A specific function implementation exists which performs also input
parameter validation.
http://lxr.free-electrons.com/source/drivers/sh/clk/core.c#L291
Such variants might not fit to the functions au1100fb_drv_suspend()
and au1100fb_drv_resume().
Do you want that I send a reduced patch?
Regards,
Markus
^ permalink raw reply [flat|nested] 38+ messages in thread
* Re: [PATCH] au1100fb: Delete unnecessary checks before two function calls
2015-02-05 14:20 ` SF Markus Elfring
@ 2015-02-05 17:18 ` Dan Carpenter
2015-02-05 20:15 ` SF Markus Elfring
0 siblings, 1 reply; 38+ messages in thread
From: Dan Carpenter @ 2015-02-05 17:18 UTC (permalink / raw)
To: SF Markus Elfring
Cc: Jean-Christophe Plagniol-Villard, Tomi Valkeinen, linux-fbdev,
LKML, kernel-janitors, Julia Lawall
On Thu, Feb 05, 2015 at 03:20:27PM +0100, SF Markus Elfring wrote:
> >> The functions clk_enable() and clk_disable() test whether their argument
> >> is NULL and then return immediately.
> >
> > This isn't true for clk_enable().
>
> I stumble on an interesting name space issue once more.
>
The "once more" is the problem in this statement. Other people would
have stopped making the mistake by now. I am able to see your bugs so
you should be able to see your bugs as well.
>
> > It's frustrating that you make the same mistake over and over
> > and you are fine with doing that.
>
> I admit that there can be also risks with my update suggestions
> in similar ways to contributions from other software developers.
>
At times, I have told other people to stop sending cleanups until they
can at least fix a bugs to balance out the bugs they have introduced.
It's unacceptable to only introduce bugs and never fix any.
regards,
dan carpenter
^ permalink raw reply [flat|nested] 38+ messages in thread
* Re: [PATCH] au1100fb: Delete unnecessary checks before two function calls
2015-02-05 17:18 ` Dan Carpenter
@ 2015-02-05 20:15 ` SF Markus Elfring
0 siblings, 0 replies; 38+ messages in thread
From: SF Markus Elfring @ 2015-02-05 20:15 UTC (permalink / raw)
To: Dan Carpenter
Cc: Jean-Christophe Plagniol-Villard, Tomi Valkeinen, linux-fbdev,
LKML, kernel-janitors, Julia Lawall
> It's unacceptable to only introduce bugs
Such a view is generally fine.
Would you like to point any more update candidates out from my
suggestion collection?
> and never fix any.
Would you like to clarify any statistics around my update suggestions?
Regards,
Markus
^ permalink raw reply [flat|nested] 38+ messages in thread
* [PATCH] video: fbdev-SIS: Deletion of unnecessary checks before three function calls
[not found] ` <5317A59D.4@users.sourceforge.net>
` (12 preceding siblings ...)
2015-02-05 13:14 ` [PATCH] au1100fb: Delete unnecessary checks before two function calls SF Markus Elfring
@ 2015-02-21 13:26 ` SF Markus Elfring
2015-06-28 12:36 ` [PATCH] video: fbdev: omap2: displays-new: Delete a check before backlight_device_unregister() SF Markus Elfring
2016-07-23 17:37 ` [PATCH] omapfb: panel-dsi-cm: Delete an unnecessary " SF Markus Elfring
15 siblings, 0 replies; 38+ messages in thread
From: SF Markus Elfring @ 2015-02-21 13:26 UTC (permalink / raw)
To: Jean-Christophe Plagniol-Villard, Thomas Winischhofer,
Tomi Valkeinen, linux-fbdev
Cc: LKML, kernel-janitors, Julia Lawall
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Sat, 21 Feb 2015 14:14:56 +0100
The functions sisfb_search_crt2type(), sisfb_search_specialtiming() and
sisfb_search_tvstd() test whether their argument is NULL and then
return immediately. Thus the test around their calls is not needed.
This issue was detected by using the Coccinelle software.
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
drivers/video/fbdev/sis/sis_main.c | 11 +++--------
1 file changed, 3 insertions(+), 8 deletions(-)
diff --git a/drivers/video/fbdev/sis/sis_main.c b/drivers/video/fbdev/sis/sis_main.c
index fcf610e..20ca80f 100644
--- a/drivers/video/fbdev/sis/sis_main.c
+++ b/drivers/video/fbdev/sis/sis_main.c
@@ -6605,12 +6605,9 @@ static int __init sisfb_init_module(void)
sisfb_scalelcd = scalelcd ^ 1;
/* Need to check crt2 type first for fstn/dstn */
+ sisfb_search_crt2type(forcecrt2type);
- if(forcecrt2type)
- sisfb_search_crt2type(forcecrt2type);
-
- if(tvstandard)
- sisfb_search_tvstd(tvstandard);
+ sisfb_search_tvstd(tvstandard);
if(mode)
sisfb_search_mode(mode, false);
@@ -6656,9 +6653,7 @@ static int __init sisfb_init_module(void)
sisfb_pdca = (pdc1 & 0x1f);
sisfb_nocrt2rate = nocrt2rate;
-
- if(specialtiming)
- sisfb_search_specialtiming(specialtiming);
+ sisfb_search_specialtiming(specialtiming);
if((lvdshl >= 0) && (lvdshl <= 3))
sisfb_lvdshl = lvdshl;
--
2.3.0
^ permalink raw reply related [flat|nested] 38+ messages in thread
* Re: [PATCH v2] backlight: lp8788: Deletion of a check before backlight_device_unregister()
2014-11-24 18:05 ` [PATCH v2] backlight: lp8788: Deletion of a check before backlight_device_unregister() SF Markus Elfring
@ 2015-06-28 12:07 ` SF Markus Elfring
2015-07-01 8:06 ` Lee Jones
0 siblings, 1 reply; 38+ messages in thread
From: SF Markus Elfring @ 2015-06-28 12:07 UTC (permalink / raw)
To: Lee Jones, Bryan Wu, Jean-Christophe Plagniol-Villard, Jingoo Han,
Tomi Valkeinen, linux-fbdev
Cc: LKML, kernel-janitors, Julia Lawall
> From: Markus Elfring <elfring@users.sourceforge.net>
>
> The backlight_device_unregister() function tests whether its argument is NULL
> and then returns immediately. Thus the test around the call is not needed.
>
> This issue was detected by using the Coccinelle software.
>
> Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
> ---
> drivers/video/backlight/lp8788_bl.c | 3 +--
> 1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/drivers/video/backlight/lp8788_bl.c b/drivers/video/backlight/lp8788_bl.c
> index d6c4f6a..24a055c 100644
> --- a/drivers/video/backlight/lp8788_bl.c
> +++ b/drivers/video/backlight/lp8788_bl.c
> @@ -221,8 +221,7 @@ static void lp8788_backlight_unregister(struct lp8788_bl *bl)
> {
> struct backlight_device *bl_dev = bl->bl_dev;
>
> - if (bl_dev)
> - backlight_device_unregister(bl_dev);
> + backlight_device_unregister(bl_dev);
> }
>
> static ssize_t lp8788_get_bl_ctl_mode(struct device *dev,
>
Would you like to integrate this update suggestion
into another source code repository?
Regards,
Markus
^ permalink raw reply [flat|nested] 38+ messages in thread
* [PATCH] video: fbdev: omap2: displays-new: Delete a check before backlight_device_unregister()
[not found] ` <5317A59D.4@users.sourceforge.net>
` (13 preceding siblings ...)
2015-02-21 13:26 ` [PATCH] video: fbdev-SIS: Deletion of unnecessary checks before three " SF Markus Elfring
@ 2015-06-28 12:36 ` SF Markus Elfring
2016-07-23 17:37 ` [PATCH] omapfb: panel-dsi-cm: Delete an unnecessary " SF Markus Elfring
15 siblings, 0 replies; 38+ messages in thread
From: SF Markus Elfring @ 2015-06-28 12:36 UTC (permalink / raw)
To: Jean-Christophe Plagniol-Villard, Tomi Valkeinen, linux-omap,
linux-fbdev
Cc: LKML, kernel-janitors, Julia Lawall
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Sun, 28 Jun 2015 14:30:17 +0200
The backlight_device_unregister() function tests whether its argument is NULL
and then returns immediately. Thus the test around the call is not needed.
This issue was detected by using the Coccinelle software.
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
drivers/video/fbdev/omap2/displays-new/panel-dsi-cm.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/drivers/video/fbdev/omap2/displays-new/panel-dsi-cm.c b/drivers/video/fbdev/omap2/displays-new/panel-dsi-cm.c
index 3414c26..d2caa41 100644
--- a/drivers/video/fbdev/omap2/displays-new/panel-dsi-cm.c
+++ b/drivers/video/fbdev/omap2/displays-new/panel-dsi-cm.c
@@ -1323,8 +1323,7 @@ static int dsicm_probe(struct platform_device *pdev)
return 0;
err_sysfs_create:
- if (bldev != NULL)
- backlight_device_unregister(bldev);
+ backlight_device_unregister(bldev);
err_bl:
destroy_workqueue(ddata->workqueue);
err_reg:
--
2.4.4
^ permalink raw reply related [flat|nested] 38+ messages in thread
* Re: [PATCH v2] backlight: lp8788: Deletion of a check before backlight_device_unregister()
2015-06-28 12:07 ` SF Markus Elfring
@ 2015-07-01 8:06 ` Lee Jones
2015-07-01 10:30 ` [PATCH v3] video-lp8788: Delete " SF Markus Elfring
0 siblings, 1 reply; 38+ messages in thread
From: Lee Jones @ 2015-07-01 8:06 UTC (permalink / raw)
To: SF Markus Elfring
Cc: Bryan Wu, Jean-Christophe Plagniol-Villard, Jingoo Han,
Tomi Valkeinen, linux-fbdev, LKML, kernel-janitors, Julia Lawall
On Sun, 28 Jun 2015, SF Markus Elfring wrote:
> > From: Markus Elfring <elfring@users.sourceforge.net>
> >
> > The backlight_device_unregister() function tests whether its argument is NULL
> > and then returns immediately. Thus the test around the call is not needed.
> >
> > This issue was detected by using the Coccinelle software.
> >
> > Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
> > ---
> > drivers/video/backlight/lp8788_bl.c | 3 +--
> > 1 file changed, 1 insertion(+), 2 deletions(-)
> >
> > diff --git a/drivers/video/backlight/lp8788_bl.c b/drivers/video/backlight/lp8788_bl.c
> > index d6c4f6a..24a055c 100644
> > --- a/drivers/video/backlight/lp8788_bl.c
> > +++ b/drivers/video/backlight/lp8788_bl.c
> > @@ -221,8 +221,7 @@ static void lp8788_backlight_unregister(struct lp8788_bl *bl)
> > {
> > struct backlight_device *bl_dev = bl->bl_dev;
> >
> > - if (bl_dev)
> > - backlight_device_unregister(bl_dev);
> > + backlight_device_unregister(bl_dev);
> > }
> >
> > static ssize_t lp8788_get_bl_ctl_mode(struct device *dev,
> >
>
> Would you like to integrate this update suggestion
> into another source code repository?
If this patch has not received any attention in some time, it's
possible that it may have slipped through the gaps. Please
re-submit the set.
--
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog
^ permalink raw reply [flat|nested] 38+ messages in thread
* [PATCH v3] video-lp8788: Delete a check before backlight_device_unregister()
2015-07-01 8:06 ` Lee Jones
@ 2015-07-01 10:30 ` SF Markus Elfring
2015-07-02 4:44 ` Jingoo Han
2015-07-07 7:13 ` Lee Jones
0 siblings, 2 replies; 38+ messages in thread
From: SF Markus Elfring @ 2015-07-01 10:30 UTC (permalink / raw)
To: Lee Jones, Jingoo Han, Jean-Christophe Plagniol-Villard,
Tomi Valkeinen, linux-fbdev
Cc: Linux Kernel Mailing List, kernel-janitors, Julia Lawall
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Wed, 1 Jul 2015 12:08:31 +0200
The backlight_device_unregister() function tests whether its argument
is NULL and then returns immediately.
Thus the test around the call is not needed.
This issue was detected by using the Coccinelle software.
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
drivers/video/backlight/lp8788_bl.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/drivers/video/backlight/lp8788_bl.c b/drivers/video/backlight/lp8788_bl.c
index e418d5b..5d583d7 100644
--- a/drivers/video/backlight/lp8788_bl.c
+++ b/drivers/video/backlight/lp8788_bl.c
@@ -221,8 +221,7 @@ static void lp8788_backlight_unregister(struct lp8788_bl *bl)
{
struct backlight_device *bl_dev = bl->bl_dev;
- if (bl_dev)
- backlight_device_unregister(bl_dev);
+ backlight_device_unregister(bl_dev);
}
static ssize_t lp8788_get_bl_ctl_mode(struct device *dev,
--
2.4.5
^ permalink raw reply related [flat|nested] 38+ messages in thread
* Re: [PATCH v3] video-lp8788: Delete a check before backlight_device_unregister()
2015-07-01 10:30 ` [PATCH v3] video-lp8788: Delete " SF Markus Elfring
@ 2015-07-02 4:44 ` Jingoo Han
2015-07-07 7:13 ` Lee Jones
1 sibling, 0 replies; 38+ messages in thread
From: Jingoo Han @ 2015-07-02 4:44 UTC (permalink / raw)
To: SF Markus Elfring
Cc: Lee Jones, Jean-Christophe Plagniol-Villard, Tomi Valkeinen,
linux-fbdev@vger.kernel.org, Linux Kernel Mailing List,
kernel-janitors@vger.kernel.org, Julia Lawall, jingoo1han
> On 2015. 7. 1., at PM 7:30, SF Markus Elfring <elfring@users.sourceforge.net> wrote:
>
> From: Markus Elfring <elfring@users.sourceforge.net>
> Date: Wed, 1 Jul 2015 12:08:31 +0200
>
> The backlight_device_unregister() function tests whether its argument
> is NULL and then returns immediately.
> Thus the test around the call is not needed.
>
> This issue was detected by using the Coccinelle software.
>
> Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
It looks good.
Acked-by: Jingoo Han <jingoohan1@gmail.com>
> ---
> drivers/video/backlight/lp8788_bl.c | 3 +--
> 1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/drivers/video/backlight/lp8788_bl.c b/drivers/video/backlight/lp8788_bl.c
> index e418d5b..5d583d7 100644
> --- a/drivers/video/backlight/lp8788_bl.c
> +++ b/drivers/video/backlight/lp8788_bl.c
> @@ -221,8 +221,7 @@ static void lp8788_backlight_unregister(struct lp8788_bl *bl)
> {
> struct backlight_device *bl_dev = bl->bl_dev;
>
> - if (bl_dev)
> - backlight_device_unregister(bl_dev);
> + backlight_device_unregister(bl_dev);
> }
>
> static ssize_t lp8788_get_bl_ctl_mode(struct device *dev,
> --
> 2.4.5
>
^ permalink raw reply [flat|nested] 38+ messages in thread
* Re: [PATCH v3] video-lp8788: Delete a check before backlight_device_unregister()
2015-07-01 10:30 ` [PATCH v3] video-lp8788: Delete " SF Markus Elfring
2015-07-02 4:44 ` Jingoo Han
@ 2015-07-07 7:13 ` Lee Jones
1 sibling, 0 replies; 38+ messages in thread
From: Lee Jones @ 2015-07-07 7:13 UTC (permalink / raw)
To: SF Markus Elfring
Cc: Jingoo Han, Jean-Christophe Plagniol-Villard, Tomi Valkeinen,
linux-fbdev, Linux Kernel Mailing List, kernel-janitors,
Julia Lawall
On Wed, 01 Jul 2015, SF Markus Elfring wrote:
> From: Markus Elfring <elfring@users.sourceforge.net>
> Date: Wed, 1 Jul 2015 12:08:31 +0200
>
> The backlight_device_unregister() function tests whether its argument
> is NULL and then returns immediately.
> Thus the test around the call is not needed.
>
> This issue was detected by using the Coccinelle software.
>
> Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
> ---
> drivers/video/backlight/lp8788_bl.c | 3 +--
> 1 file changed, 1 insertion(+), 2 deletions(-)
Applied, thanks.
> diff --git a/drivers/video/backlight/lp8788_bl.c b/drivers/video/backlight/lp8788_bl.c
> index e418d5b..5d583d7 100644
> --- a/drivers/video/backlight/lp8788_bl.c
> +++ b/drivers/video/backlight/lp8788_bl.c
> @@ -221,8 +221,7 @@ static void lp8788_backlight_unregister(struct lp8788_bl *bl)
> {
> struct backlight_device *bl_dev = bl->bl_dev;
>
> - if (bl_dev)
> - backlight_device_unregister(bl_dev);
> + backlight_device_unregister(bl_dev);
> }
>
> static ssize_t lp8788_get_bl_ctl_mode(struct device *dev,
--
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog
^ permalink raw reply [flat|nested] 38+ messages in thread
* [PATCH] omapfb: panel-dsi-cm: Delete an unnecessary check before backlight_device_unregister()
[not found] ` <5317A59D.4@users.sourceforge.net>
` (14 preceding siblings ...)
2015-06-28 12:36 ` [PATCH] video: fbdev: omap2: displays-new: Delete a check before backlight_device_unregister() SF Markus Elfring
@ 2016-07-23 17:37 ` SF Markus Elfring
15 siblings, 0 replies; 38+ messages in thread
From: SF Markus Elfring @ 2016-07-23 17:37 UTC (permalink / raw)
To: linux-fbdev, linux-omap, Dave Airlie,
Jean-Christophe Plagniol-Villard, Peter Ujfalusi, Rob Clark,
Tomi Valkeinen
Cc: LKML, kernel-janitors, Julia Lawall
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Sat, 23 Jul 2016 19:29:28 +0200
The backlight_device_unregister() function tests whether its argument
is NULL and then returns immediately.
Thus the test around the call is not needed.
This issue was detected by using the Coccinelle software.
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
drivers/video/fbdev/omap2/omapfb/displays/panel-dsi-cm.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/drivers/video/fbdev/omap2/omapfb/displays/panel-dsi-cm.c b/drivers/video/fbdev/omap2/omapfb/displays/panel-dsi-cm.c
index b58012b..9d308db 100644
--- a/drivers/video/fbdev/omap2/omapfb/displays/panel-dsi-cm.c
+++ b/drivers/video/fbdev/omap2/omapfb/displays/panel-dsi-cm.c
@@ -1283,8 +1283,7 @@ static int dsicm_probe(struct platform_device *pdev)
return 0;
err_sysfs_create:
- if (bldev != NULL)
- backlight_device_unregister(bldev);
+ backlight_device_unregister(bldev);
err_bl:
destroy_workqueue(ddata->workqueue);
err_reg:
--
2.9.2
^ permalink raw reply related [flat|nested] 38+ messages in thread
end of thread, other threads:[~2016-07-23 17:37 UTC | newest]
Thread overview: 38+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <5307CAA2.8060406@users.sourceforge.net>
[not found] ` <alpine.DEB.2.02.1402212321410.2043@localhost6.localdomain6>
[not found] ` <530A086E.8010901@users.sourceforge.net>
[not found] ` <alpine.DEB.2.02.1402231635510.1985@localhost6.localdomain6>
[not found] ` <530A72AA.3000601@users.sourceforge.net>
[not found] ` <alpine.DEB.2.02.1402240658210.2090@localhost6.localdomain6>
[not found] ` <530B5FB6.6010207@users.sourceforge.net>
[not found] ` <alpine.DEB.2.10.1402241710370.2074@hadrien>
[not found] ` <530C5E18.1020800@users.sourceforge.net>
[not found] ` <alpine.DEB.2.10.1402251014170.2080@hadrien>
[not found] ` <530CD2C4.4050903@users.sourceforge.net>
[not found] ` <alpine.DEB.2.10.1402251840450.7035@hadrien>
[not found] ` <530CF8FF.8080600@users.sourceforge.net>
[not found] ` <alpine.DEB.2.02.1402252117150.2047@localhost6.localdomain6>
[not found] ` <530DD06F.4090703@users.sourceforge.net>
[not found] ` <alpine.DEB.2.02.1402262129250.2221@localhost6.localdomain6>
[not found] ` <5317A59D.4@users.sourceforge.net>
2014-11-22 16:00 ` [PATCH 1/1] video: fbdev-LCDC: Deletion of an unnecessary check before the function call "vfree" SF Markus Elfring
2014-12-04 14:19 ` Tomi Valkeinen
2014-11-23 10:11 ` [PATCH 1/1] video: uvesafb: Deletion of an unnecessary check before the function call "uvesafb_free" SF Markus Elfring
2014-11-23 10:44 ` [PATCH 1/1] video: udlfb: Deletion of unnecessary checks before the function call "vfree" SF Markus Elfring
2014-11-23 11:33 ` [PATCH 1/1] video: smscufx: " SF Markus Elfring
2014-11-23 12:00 ` [PATCH 1/1] video: fbdev-SIS: Deletion of unnecessary checks before the function call "pci_dev_put" SF Markus Elfring
2014-11-23 13:14 ` [PATCH 1/1] video: fbdev-OMAP2: Deletion of unnecessary checks before the function call "i2c_put_ada SF Markus Elfring
2014-11-23 14:20 ` [PATCH 1/1] video: mx3fb: Deletion of an unnecessary check before the function call "backlight_devic SF Markus Elfring
2014-11-23 15:00 ` [PATCH 1/1] video: fbdev-MMP: Deletion of an unnecessary check before the function call "mmp_unregis SF Markus Elfring
2014-11-23 15:33 ` [PATCH 1/1] video: fbdev-VIA: Deletion of an unnecessary check before the function call "framebuffer SF Markus Elfring
2014-11-23 16:10 ` [PATCH 1/1] video: uvesafb: Deletion of an unnecessary check before the function call "platform_devi SF Markus Elfring
2014-11-23 16:40 ` [PATCH 1/1] backlight: lp8788: Deletion of an unnecessary check before the function call "backlight_ SF Markus Elfring
2014-11-24 10:09 ` [PATCH 1/1] backlight: lp8788: Deletion of an unnecessary check before the function call "backli Lee Jones
2014-11-24 10:10 ` Lee Jones
2014-11-24 18:05 ` [PATCH v2] backlight: lp8788: Deletion of a check before backlight_device_unregister() SF Markus Elfring
2015-06-28 12:07 ` SF Markus Elfring
2015-07-01 8:06 ` Lee Jones
2015-07-01 10:30 ` [PATCH v3] video-lp8788: Delete " SF Markus Elfring
2015-07-02 4:44 ` Jingoo Han
2015-07-07 7:13 ` Lee Jones
2015-01-19 17:54 ` [PATCH 0/9] video: fbdev: Deletion of some unnecessary checks SF Markus Elfring
2015-01-19 18:00 ` [PATCH 1/9] video: Deletion of checks before the function call "iounmap" SF Markus Elfring
2015-01-19 18:25 ` video: One function call less in tdfxfb_probe() after error detection SF Markus Elfring
2015-01-19 18:30 ` [PATCH 3/9] video: One function call less in vesafb_probe() after, " SF Markus Elfring
2015-01-19 18:34 ` [PATCH 4/9] video: Add check for return value of ioremap() in cirrusfb_pci_register() SF Markus Elfring
2015-01-19 18:38 ` [PATCH 5/9] video: Less function calls in trident_pci_probe() after error detection SF Markus Elfring
2015-01-19 18:41 ` [PATCH 6/9] video: One function call less in pvr2fb_common_init() " SF Markus Elfring
2015-01-19 18:43 ` [PATCH 7/9] video: One function call less in tgafb_register() after, " SF Markus Elfring
2015-01-19 18:46 ` [PATCH 8/9] video: Less function calls in valkyriefb_init() after " SF Markus Elfring
2015-01-19 18:49 ` [PATCH 9/9] video: Less function calls in w100fb_probe() " SF Markus Elfring
2015-02-05 13:14 ` [PATCH] au1100fb: Delete unnecessary checks before two function calls SF Markus Elfring
2015-02-05 13:41 ` Dan Carpenter
2015-02-05 14:20 ` SF Markus Elfring
2015-02-05 17:18 ` Dan Carpenter
2015-02-05 20:15 ` SF Markus Elfring
2015-02-21 13:26 ` [PATCH] video: fbdev-SIS: Deletion of unnecessary checks before three " SF Markus Elfring
2015-06-28 12:36 ` [PATCH] video: fbdev: omap2: displays-new: Delete a check before backlight_device_unregister() SF Markus Elfring
2016-07-23 17:37 ` [PATCH] omapfb: panel-dsi-cm: Delete an unnecessary " SF Markus Elfring
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).