Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp1944849ybv; Fri, 14 Feb 2020 08:39:12 -0800 (PST) X-Google-Smtp-Source: APXvYqyh7jfEc+C/kmVeTj9tvpALjbAZDuYsSz0taErR3XHeDatF4kU8PI67xLCRDZFz6/EqQgUX X-Received: by 2002:a9d:6d1a:: with SMTP id o26mr2870235otp.141.1581698352223; Fri, 14 Feb 2020 08:39:12 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1581698352; cv=none; d=google.com; s=arc-20160816; b=KT/3Ba+poxdKVwq+5/qOnaxIyKLqAF4qmwvbeouiZvuR3TWJnH+r3Y8Zd+x5ZgZoNc dl9Zo+mPSm5/mxxO2Uy8hCbSgd/os9ZIesAcI9XaZ9lysZ5sFXBUcsyUaflQ3+ceO1v4 KJK++KroXPVrI/MIDSUEM1NzlaiFrc8CzJQJoMh76rScO8WLnK+6xEiuWCXdwtYbHaeX vt530mey1Pa0jSqh1jPxJagLqalmtZLrdJKOLb+QC1CtE8tlLFD7DN3jK7NyFLUdi2hD k8oHzhqQWDHU+RAHN/dBWtmCtG3eYEKUEnP6xxSfl1lxERXwrprY6MilEgBS3HqKSSJO BwFw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=acuAv9MSevw0JU5uBa9/MhshWlYRU6T4GSvhzufDkJ0=; b=naJWbrFvbaOWSQ9uwSWwVph+gTqQC1sBDzpi5HtMI7+jT33IQqxGbIfc3nkMQFlJg+ V8Rqm2N5XNk+YLlF67KiBDwnHon4cHM7L1KEAeQvODV4B5lYAGYbDpR3e1SPrj1QqWQh nZXx+iYace3ZRf4vU5PV3PjqQlpzwji2k1CUgGgLtf1EeBa21N4ksNfUR16rxX5tWf1K Qa8ZQWzBBRE6Qfv49YtmQ/fSWWrekd2geIC9lA4oksGi9ZyILWamgNeJVX0xqUtvsxsV 14lOCQVAr4vDyzcUXMZVi/JTSUyzVDeBhtAZetkd6Ecm3JZr3+hdEDjcSMxPq+NTBT1u jGuA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=l0fIVzRw; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c11si2956054oic.20.2020.02.14.08.39.00; Fri, 14 Feb 2020 08:39:12 -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; dkim=pass header.i=@kernel.org header.s=default header.b=l0fIVzRw; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2393863AbgBNQiZ (ORCPT + 99 others); Fri, 14 Feb 2020 11:38:25 -0500 Received: from mail.kernel.org ([198.145.29.99]:59950 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2405672AbgBNQXf (ORCPT ); Fri, 14 Feb 2020 11:23:35 -0500 Received: from sasha-vm.mshome.net (c-73-47-72-35.hsd1.nh.comcast.net [73.47.72.35]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 18C3D2477D; Fri, 14 Feb 2020 16:23:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1581697414; bh=OjlB9AVcPer6GvN/IsZeDID4gRoeRc0i8+HUSWT00wc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=l0fIVzRwbiFySQ1Er1Yi87HSW8RuSFNjsNdVzpEhmsE6x5rlQpExda1oUNr/sfWF9 BqwnJz+KGadwVpR23BUUbzpRaguosKwa4BNfC/J/vE6wRNYTlgGtnFP5hVQh5IS2xq 5kzl0Br4Odh2kMcf3zRcwS8YLG+05A7NBzf7C6oU= From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: =?UTF-8?q?Uwe=20Kleine-K=C3=B6nig?= , Thierry Reding , Sasha Levin , linux-pwm@vger.kernel.org Subject: [PATCH AUTOSEL 4.9 105/141] pwm: omap-dmtimer: Remove PWM chip in .remove before making it unfunctional Date: Fri, 14 Feb 2020 11:20:45 -0500 Message-Id: <20200214162122.19794-105-sashal@kernel.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200214162122.19794-1-sashal@kernel.org> References: <20200214162122.19794-1-sashal@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Uwe Kleine-König [ Upstream commit 43efdc8f0e6d7088ec61bd55a73bf853f002d043 ] In the old code (e.g.) mutex_destroy() was called before pwmchip_remove(). Between these two calls it is possible that a PWM callback is used which tries to grab the mutex. Fixes: 6604c6556db9 ("pwm: Add PWM driver for OMAP using dual-mode timers") Signed-off-by: Uwe Kleine-König Signed-off-by: Thierry Reding Signed-off-by: Sasha Levin --- drivers/pwm/pwm-omap-dmtimer.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/drivers/pwm/pwm-omap-dmtimer.c b/drivers/pwm/pwm-omap-dmtimer.c index 5ad42f33e70c1..2e15acf13893d 100644 --- a/drivers/pwm/pwm-omap-dmtimer.c +++ b/drivers/pwm/pwm-omap-dmtimer.c @@ -337,6 +337,11 @@ static int pwm_omap_dmtimer_probe(struct platform_device *pdev) static int pwm_omap_dmtimer_remove(struct platform_device *pdev) { struct pwm_omap_dmtimer_chip *omap = platform_get_drvdata(pdev); + int ret; + + ret = pwmchip_remove(&omap->chip); + if (ret) + return ret; if (pm_runtime_active(&omap->dm_timer_pdev->dev)) omap->pdata->stop(omap->dm_timer); @@ -345,7 +350,7 @@ static int pwm_omap_dmtimer_remove(struct platform_device *pdev) mutex_destroy(&omap->mutex); - return pwmchip_remove(&omap->chip); + return 0; } static const struct of_device_id pwm_omap_dmtimer_of_match[] = { -- 2.20.1