Skip to content

Commit ec5a465

Browse files
committed
opp: core: remove useless mutex protection in _allocate_opp_table
Mutex protection in not needed in _allocate_opp_table as it this function is already called under mutex lock. Furthermore, it fixes the following issue seen with CONFIG_PROVE_LOCKING flag: [ 3.648912] ========================= [ 3.648927] WARNING: held lock freed! [ 3.648944] 5.4.56-00014-g7cc4a3bdec16 #7 Not tainted [ 3.648957] ------------------------- [ 3.648976] kworker/1:1/22 is freeing memory df183c00-df183fff, with a lock still held there! [ 3.648991] df183ca0 (&opp_table->lock){+.+.}, at: _opp_get_opp_table+0x1cc/0x224 [ 3.649037] 5 locks held by kworker/1:1/22: [ 3.649049] #0: df0086a0 ((wq_completion)events){+.+.}, at: process_one_work+0x200/0x858 [ 3.649082] #1: df515f1c (deferred_probe_work){+.+.}, at: process_one_work+0x200/0x858 [ 3.649110] #2: d1ff08cc (&dev->mutex){....}, at: __device_attach+0x34/0x17c [ 3.649145] #3: c139e5e0 (opp_table_lock){+.+.}, at: _opp_get_opp_table+0x1c/0x224 [ 3.649175] #4: df183ca0 (&opp_table->lock){+.+.}, at: _opp_get_opp_table+0x1cc/0x224 Fixes: cf1f361 ("opp: core: fix memory leak in probe deferral") Signed-off-by: Alexandre Torgue <alexandre.torgue@st.com> Change-Id: I6da51fab26b698bb803a3a8ddf5454f73d8af956 Reviewed-on: https://gerrit.st.com/c/mpu/oe/st/linux-stm32/+/178474 Reviewed-by: CITOOLS <smet-aci-reviews@lists.codex.cro.st.com>
1 parent 7cc4a3b commit ec5a465

File tree

1 file changed

+0
-2
lines changed

1 file changed

+0
-2
lines changed

drivers/opp/core.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -985,10 +985,8 @@ static struct opp_table *_allocate_opp_table(struct device *dev, int index)
985985
ret);
986986
}
987987
else {
988-
mutex_lock(&opp_table->lock);
989988
_remove_opp_dev(opp_dev, opp_table);
990989
kfree(opp_table);
991-
mutex_unlock(&opp_table->lock);
992990
return ERR_PTR(-EPROBE_DEFER);
993991
}
994992
}

0 commit comments

Comments
 (0)