Received: by 2002:ac0:8c8e:0:0:0:0:0 with SMTP id r14csp719207ima; Wed, 6 Feb 2019 07:17:39 -0800 (PST) X-Google-Smtp-Source: AHgI3IY0p7sQslQ4eEP+2IKrwDkXrH4QZO6F+I3CdzOcDd3UnUniMweW03gD75R2yiAQZOELZ8fG X-Received: by 2002:a65:624c:: with SMTP id q12mr10103986pgv.379.1549466258965; Wed, 06 Feb 2019 07:17:38 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1549466258; cv=none; d=google.com; s=arc-20160816; b=zNteOB8tuzUzm8OF218I6EdNjTF+jJnf2nCFniDVfnl+E9h0qNromTTK9bsMSG43UX pt4ndO/C80ZcoA8lYzyF/SQc/KV+QrXP/enYJAF+w8hLUqKyWk8xrmisX3kuWr3ldAjA ndGX2cLkZ1YolpspkRV0AZpzFX6LdpRxQSyPaUPbdcIimav1K5OoYQoIvaYBA4TTHLwp 9xBJiUH9hg0Gvzd19Ve7k/AREq7kopiTAA5oeslo9w8rnJmfWMXPU+vmleh1bUcMW+n7 0WzeS6bipd4gU5Rc6hwsx8EpV3VV03lXbpJ/ivWiZpWzGdCvta3fb3WYfM/ghNxNQk3S PwpQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:message-id :subject:cc:to:from:date; bh=0XudfnnFHhMwB92YxyuLY2wBT6UG15EtNcGEBsxRpRY=; b=xfBKU9OxXceZFBZnlHm56j3kWsEU2w+Fvkr1x69XB9jgwGQMeuwtc3OJvuif2o8jRu egU9tSCGyahYq7D4XycYdWmfp5gU8fGsHslShKFLz4VHFRFv8iAJo73pHnLOxG/gZruZ MujbKwrmunQsp25sWPgpV2HWm2/X/9Pb95ZXIZEvd8tbnzAPOEDguvxem1mPuObM3pdh kdg6ciY+jd41tvlSa7sMdkwahbGpQmFvUKJ6hJgNrN89Lr6HeECiqqQM5Gf7LapnOBl2 Fc5w812m9mk7oAH25AfZMShwPzJPiEpaNR0pcEaITcnpA59817+MNJpJff/hAErUtwq8 YogQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id e33si2418680pld.397.2019.02.06.07.17.23; Wed, 06 Feb 2019 07:17:38 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729882AbfBFOhW (ORCPT + 99 others); Wed, 6 Feb 2019 09:37:22 -0500 Received: from mout.gmx.net ([212.227.17.21]:54675 "EHLO mout.gmx.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726914AbfBFOhV (ORCPT ); Wed, 6 Feb 2019 09:37:21 -0500 Received: from axis700.grange ([87.78.226.14]) by mail.gmx.com (mrgmx101 [212.227.17.168]) with ESMTPSA (Nemesis) id 0M6vSj-1h5kJF3Sth-00wlO6; Wed, 06 Feb 2019 15:37:16 +0100 Received: by axis700.grange (Postfix, from userid 1000) id DCC9A61D03; Wed, 6 Feb 2019 09:06:51 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by axis700.grange (Postfix) with ESMTP id C75C161CFC; Wed, 6 Feb 2019 09:06:51 +0100 (CET) Date: Wed, 6 Feb 2019 09:06:51 +0100 (CET) From: Guennadi Liakhovetski X-X-Sender: lyakh@axis700.grange To: linux-kernel@vger.kernel.org cc: Liam Girdwood , Mark Brown Subject: regulator: fix device unlinking Message-ID: User-Agent: Alpine 2.20 (DEB 67 2015-01-07) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII X-Provags-ID: V03:K1:jHUsWiGGIbZ2NUEFFdIRl77IkXczcVIqILzHlay5Cc/OFxbxDOo NizEXraMUVz4V1FnHDWFcydhjPzqb0kTdFHl+NLADLaIaMhJeJ737W6mbAtoqhXQ78nd3Mq 4hbycjAERu2MVjEoM87p8A0aIDzIq1u60TcanoRA7k/Nn0qkDYhjohpAHrppkoj3Labcyyw DwQopO8uFM4TGxfTmYBgg== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1;V03:K0:dk/dnJAx/Lc=:dsCq9M+T6G2EUlBkuow6bG EjPnDQPEkHq/z/1PJC94mEs3bDIR1A7IWjmKuuz7EFYB5cw1yp5acnGEsONmYbvfQPwutwNUH OhI15X/1tWyI4aYGRNK2h75Hlpxs9YsJKp+cej+E7VzXBFbt2p6ITkPvv/54CrEVvNfQU9oEH Ujb/iB++oPgjKt7PaaM6vIS5vpnhsAjrt9WRFCMgaA4da0zOfOFwBl64b2rpNu1RU7kWHQTi2 ESNBLXLwaHrGu+yVoafhaNvqP0wlBfcsZbvGWAFbGUUD/rky4e0gqASyMsXX1ob2aAqXW4niA JGH5PE157pvEszO7p7CglGx8CHXONLFCOjcXEG752FK5s9khwUmyTIGwDngVpVjzaPvnZU3V1 zMxjaJ/TsmPTjUKHJgK/ii8MZ0QpkbQjPMBNET3moAK85ejXUH8ucFbGBCbtEYuZiCaij6Dd+ nIa5LyrXkVUyx0l5H75jz1zF8MTEnrMj4ZT+8BuDI3ndhor4O/41PeapKncbZzFNuEFtkgT/r jjYKuKPfK2SJy6dN3dh/sbVNvww6M6mMGYJWrCRmKmwXkqEcwqrvPL+0ZU4H/lIQVBxORjGDO HeHb8v6P/+73DDdfokHAiG+qFkdKmGPVNbItlmSklJEsHYMKTVFv/vsBd6eIaf9YWLPeaHOdT X2a+Dx6H75IVsqie84J9aMszC+xw0+rivNkkxQ+7q04yGGsmXA6ayswWvyX6wRvRIgZdy3UFc 9GWV/qM54Ia+7VpZRwWdgY8N8k3N4urPo//zyk3V9uoM5/yYHmfYhINoL6ps4eg3p2w3pkD1j 9I/gqvdznHBT7oPURjBwiV7Oq5iXAAcRNR9Bu5qaJObH2jivjta/ILACXmY7kPSyy1pHjxe2l l8d1NTzJ63fswIIokJyQ6bTBwzaTu/LQlqsMldaj8Zl6AYnznB8FNS/3p9035Q9e6h7NInRz5 H7eB6apEi8Q== Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Guennadi Liakhovetski Device links are refcounted, device_link_remove() has to be called as many times as device_link_add(). Signed-off-by: Guennadi Liakhovetski --- drivers/regulator/core.c | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c index 2c66b528aede..342102e8bc21 100644 --- a/drivers/regulator/core.c +++ b/drivers/regulator/core.c @@ -1837,15 +1837,7 @@ static void _regulator_put(struct regulator *regulator) debugfs_remove_recursive(regulator->debugfs); if (regulator->dev) { - int count = 0; - struct regulator *r; - - list_for_each_entry(r, &rdev->consumer_list, list) - if (r->dev == regulator->dev) - count++; - - if (count == 1) - device_link_remove(regulator->dev, &rdev->dev); + device_link_remove(regulator->dev, &rdev->dev); /* remove any sysfs entries */ sysfs_remove_link(&rdev->dev.kobj, regulator->supply_name); -- 2.17.1