linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH AUTOSEL 4.9 01/14] PM / devfreq: Don't fail devfreq_dev_release if not in list
@ 2019-12-20 14:46 Sasha Levin
  2019-12-20 14:46 ` [PATCH AUTOSEL 4.9 02/14] RDMA/cma: add missed unregister_pernet_subsys in init failure Sasha Levin
                   ` (12 more replies)
  0 siblings, 13 replies; 14+ messages in thread
From: Sasha Levin @ 2019-12-20 14:46 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Leonard Crestez, Matthias Kaehlcke, Chanwoo Choi, Sasha Levin, linux-pm

From: Leonard Crestez <leonard.crestez@nxp.com>

[ Upstream commit 42a6b25e67df6ee6675e8d1eaf18065bd73328ba ]

Right now devfreq_dev_release will print a warning and abort the rest of
the cleanup if the devfreq instance is not part of the global
devfreq_list. But this is a valid scenario, for example it can happen if
the governor can't be found or on any other init error that happens
after device_register.

Initialize devfreq->node to an empty list head in devfreq_add_device so
that list_del becomes a safe noop inside devfreq_dev_release and we can
continue the rest of the cleanup.

Signed-off-by: Leonard Crestez <leonard.crestez@nxp.com>
Reviewed-by: Matthias Kaehlcke <mka@chromium.org>
Reviewed-by: Chanwoo Choi <cw00.choi@samsung.com>
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/devfreq/devfreq.c | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/drivers/devfreq/devfreq.c b/drivers/devfreq/devfreq.c
index db70cee71caa1..dc103edc9fc17 100644
--- a/drivers/devfreq/devfreq.c
+++ b/drivers/devfreq/devfreq.c
@@ -481,11 +481,6 @@ static int devfreq_notifier_call(struct notifier_block *nb, unsigned long type,
 static void _remove_devfreq(struct devfreq *devfreq)
 {
 	mutex_lock(&devfreq_list_lock);
-	if (IS_ERR(find_device_devfreq(devfreq->dev.parent))) {
-		mutex_unlock(&devfreq_list_lock);
-		dev_warn(&devfreq->dev, "releasing devfreq which doesn't exist\n");
-		return;
-	}
 	list_del(&devfreq->node);
 	mutex_unlock(&devfreq_list_lock);
 
@@ -557,6 +552,7 @@ struct devfreq *devfreq_add_device(struct device *dev,
 	devfreq->dev.parent = dev;
 	devfreq->dev.class = devfreq_class;
 	devfreq->dev.release = devfreq_dev_release;
+	INIT_LIST_HEAD(&devfreq->node);
 	devfreq->profile = profile;
 	strncpy(devfreq->governor_name, governor_name, DEVFREQ_NAME_LEN);
 	devfreq->previous_freq = profile->initial_freq;
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2019-12-20 14:48 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-12-20 14:46 [PATCH AUTOSEL 4.9 01/14] PM / devfreq: Don't fail devfreq_dev_release if not in list Sasha Levin
2019-12-20 14:46 ` [PATCH AUTOSEL 4.9 02/14] RDMA/cma: add missed unregister_pernet_subsys in init failure Sasha Levin
2019-12-20 14:46 ` [PATCH AUTOSEL 4.9 03/14] scsi: lpfc: Fix memory leak on lpfc_bsg_write_ebuf_set func Sasha Levin
2019-12-20 14:46 ` [PATCH AUTOSEL 4.9 04/14] scsi: qla2xxx: Don't call qlt_async_event twice Sasha Levin
2019-12-20 14:46 ` [PATCH AUTOSEL 4.9 05/14] scsi: iscsi: qla4xxx: fix double free in probe Sasha Levin
2019-12-20 14:46 ` [PATCH AUTOSEL 4.9 06/14] scsi: libsas: stop discovering if oob mode is disconnected Sasha Levin
2019-12-20 14:46 ` [PATCH AUTOSEL 4.9 07/14] usb: gadget: fix wrong endpoint desc Sasha Levin
2019-12-20 14:46 ` [PATCH AUTOSEL 4.9 08/14] md: raid1: check rdev before reference in raid1_sync_request func Sasha Levin
2019-12-20 14:46 ` [PATCH AUTOSEL 4.9 09/14] s390/cpum_sf: Adjust sampling interval to avoid hitting sample limits Sasha Levin
2019-12-20 14:46 ` [PATCH AUTOSEL 4.9 10/14] s390/cpum_sf: Avoid SBD overflow condition in irq handler Sasha Levin
2019-12-20 14:46 ` [PATCH AUTOSEL 4.9 11/14] IB/mlx4: Follow mirror sequence of device add during device removal Sasha Levin
2019-12-20 14:46 ` [PATCH AUTOSEL 4.9 12/14] xen-blkback: prevent premature module unload Sasha Levin
2019-12-20 14:46 ` [PATCH AUTOSEL 4.9 13/14] xen/balloon: fix ballooned page accounting without hotplug enabled Sasha Levin
2019-12-20 14:46 ` [PATCH AUTOSEL 4.9 14/14] PM / hibernate: memory_bm_find_bit(): Tighten node optimisation Sasha Levin

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).