From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.8 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1C7CCC35641 for ; Fri, 21 Feb 2020 07:56:48 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id DD7AC20578 for ; Fri, 21 Feb 2020 07:56:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1582271808; bh=ubBnZkwgknDaBQg2aA6dtbyYoa4IJ4vUfw1ndbHY2s8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=yn2CW3PHRYhpquiC4aTRyyVPQoGQlQ/5iY0ButsdNl651GkzU9mmuyWJ8XEjSUCxr N8rAGpd26aD21IQRCWa32i0F8g9hhfE6AlNNAQqx3ueSDH9TlwRH3cqBLI85wtCQ3/ Xc4jqCaauHNFSCdjD54jYnz3QhSv5Efm5Bb14lyQ= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730522AbgBUH4r (ORCPT ); Fri, 21 Feb 2020 02:56:47 -0500 Received: from mail.kernel.org ([198.145.29.99]:56152 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730515AbgBUH4n (ORCPT ); Fri, 21 Feb 2020 02:56:43 -0500 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id E17102073A; Fri, 21 Feb 2020 07:56:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1582271803; bh=ubBnZkwgknDaBQg2aA6dtbyYoa4IJ4vUfw1ndbHY2s8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=BFM/hjpUFWi8rTlIGS4OG8cafZgSqNnq/hC/4yjMgzqbxv1C0TEOAoR9xnhkk0RoX nzhg6bVmjrQkPwfgpCAnknhfimG21sAbsUHUiCdaWVu4dFqbXpjqehaabRxiKaev3B 4R10tZx4vtW7C9UfL2gMcsWM/QLBwlmGhXLY8QY4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, =?UTF-8?q?Uwe=20Kleine-K=C3=B6nig?= , Thierry Reding , Sasha Levin Subject: [PATCH 5.5 303/399] pwm: omap-dmtimer: Remove PWM chip in .remove before making it unfunctional Date: Fri, 21 Feb 2020 08:40:28 +0100 Message-Id: <20200221072431.131466238@linuxfoundation.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200221072402.315346745@linuxfoundation.org> References: <20200221072402.315346745@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 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 6cfeb0e1cc679..e36fcad668a68 100644 --- a/drivers/pwm/pwm-omap-dmtimer.c +++ b/drivers/pwm/pwm-omap-dmtimer.c @@ -361,6 +361,11 @@ put: 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); @@ -369,7 +374,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