Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1392390 > unrolled thread
| Started by | Javier Martinez Canillas <javier@osg.samsung.com> |
|---|---|
| First post | 2016-05-02 19:30 +0200 |
| Last post | 2016-05-02 21:20 +0200 |
| Articles | 3 — 2 participants |
Back to article view | Back to linux.kernel
[PATCH] s5p-mfc: Don't try to put pm->clock if lookup failed Javier Martinez Canillas <javier@osg.samsung.com> - 2016-05-02 19:30 +0200
Re: [PATCH] s5p-mfc: Don't try to put pm->clock if lookup failed Arnd Bergmann <arnd@arndb.de> - 2016-05-02 20:50 +0200
Re: [PATCH] s5p-mfc: Don't try to put pm->clock if lookup failed Javier Martinez Canillas <javier@osg.samsung.com> - 2016-05-02 21:20 +0200
| From | Javier Martinez Canillas <javier@osg.samsung.com> |
|---|---|
| Date | 2016-05-02 19:30 +0200 |
| Subject | [PATCH] s5p-mfc: Don't try to put pm->clock if lookup failed |
| Message-ID | <rupPu-7D1-37@gated-at.bofh.it> |
Failing to get the struct s5p_mfc_pm .clock is a non-fatal error so the
clock field can have a errno pointer value. But s5p_mfc_final_pm() only
checks if .clock is not NULL before attempting to unprepare and put it.
This leads to the following warning in clk_put() due s5p_mfc_final_pm():
WARNING: CPU: 3 PID: 1023 at drivers/clk/clk.c:2814 s5p_mfc_final_pm+0x48/0x74 [s5p_mfc]
CPU: 3 PID: 1023 Comm: rmmod Tainted: G W 4.6.0-rc6-next-20160502-00005-g5a15a49106bc #9
Hardware name: SAMSUNG EXYNOS (Flattened Device Tree)
[<c010e1bc>] (unwind_backtrace) from [<c010af28>] (show_stack+0x10/0x14)
[<c010af28>] (show_stack) from [<c032485c>] (dump_stack+0x88/0x9c)
[<c032485c>] (dump_stack) from [<c011b8e8>] (__warn+0xe8/0x100)
[<c011b8e8>] (__warn) from [<c011b9b0>] (warn_slowpath_null+0x20/0x28)
[<c011b9b0>] (warn_slowpath_null) from [<bf16004c>] (s5p_mfc_final_pm+0x48/0x74 [s5p_mfc])
[<bf16004c>] (s5p_mfc_final_pm [s5p_mfc]) from [<bf157414>] (s5p_mfc_remove+0x8c/0x94 [s5p_mfc])
[<bf157414>] (s5p_mfc_remove [s5p_mfc]) from [<c03fe1f8>] (platform_drv_remove+0x24/0x3c)
[<c03fe1f8>] (platform_drv_remove) from [<c03fcc70>] (__device_release_driver+0x84/0x110)
[<c03fcc70>] (__device_release_driver) from [<c03fcdd8>] (driver_detach+0xac/0xb0)
[<c03fcdd8>] (driver_detach) from [<c03fbff8>] (bus_remove_driver+0x4c/0xa0)
[<c03fbff8>] (bus_remove_driver) from [<c01886a8>] (SyS_delete_module+0x174/0x1b8)
[<c01886a8>] (SyS_delete_module) from [<c01078c0>] (ret_fast_syscall+0x0/0x3c)
So check if the pointer is not an errno value before calling clk_put().
Signed-off-by: Javier Martinez Canillas <javier@osg.samsung.com>
---
drivers/media/platform/s5p-mfc/s5p_mfc_pm.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc_pm.c b/drivers/media/platform/s5p-mfc/s5p_mfc_pm.c
index 5f97a3398c11..d011f30be265 100644
--- a/drivers/media/platform/s5p-mfc/s5p_mfc_pm.c
+++ b/drivers/media/platform/s5p-mfc/s5p_mfc_pm.c
@@ -85,7 +85,7 @@ err_g_ip_clk:
void s5p_mfc_final_pm(struct s5p_mfc_dev *dev)
{
if (dev->variant->version != MFC_VERSION_V6 &&
- pm->clock) {
+ !IS_ERR_OR_NULL(pm->clock)) {
clk_disable_unprepare(pm->clock);
clk_put(pm->clock);
}
--
2.5.5
[toc] | [next] | [standalone]
| From | Arnd Bergmann <arnd@arndb.de> |
|---|---|
| Date | 2016-05-02 20:50 +0200 |
| Message-ID | <rur4S-iN-15@gated-at.bofh.it> |
| In reply to | #1392390 |
On Monday 02 May 2016 13:27:54 Javier Martinez Canillas wrote: > Failing to get the struct s5p_mfc_pm .clock is a non-fatal error so the > clock field can have a errno pointer value. But s5p_mfc_final_pm() only > checks if .clock is not NULL before attempting to unprepare and put it. > > This leads to the following warning in clk_put() due s5p_mfc_final_pm(): > Better assign the pointer to NULL in case of a non-fatal error return code. That way, the reader doesn't have to wonder why you have the IS_ERR_OR_NULL() check here. Arnd
[toc] | [prev] | [next] | [standalone]
| From | Javier Martinez Canillas <javier@osg.samsung.com> |
|---|---|
| Date | 2016-05-02 21:20 +0200 |
| Message-ID | <rurxT-SM-1@gated-at.bofh.it> |
| In reply to | #1392451 |
Hello Arnd, Thanks for your feedback. On 05/02/2016 02:41 PM, Arnd Bergmann wrote: > On Monday 02 May 2016 13:27:54 Javier Martinez Canillas wrote: >> Failing to get the struct s5p_mfc_pm .clock is a non-fatal error so the >> clock field can have a errno pointer value. But s5p_mfc_final_pm() only >> checks if .clock is not NULL before attempting to unprepare and put it. >> >> This leads to the following warning in clk_put() due s5p_mfc_final_pm(): >> > > Better assign the pointer to NULL in case of a non-fatal error > return code. That way, the reader doesn't have to wonder why you > have the IS_ERR_OR_NULL() check here. > Ok, I'll re-spin the patch doing that instead. > Arnd > Best regards, -- Javier Martinez Canillas Open Source Group Samsung Research America
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web