Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp474468yba; Wed, 15 May 2019 04:47:17 -0700 (PDT) X-Google-Smtp-Source: APXvYqyGFp0tNdx9o8beqQS2bH+IkewoO/Ki1pAqAMKRKLTwyJHjuyUUyDmTaecb0+EsuxRME8Qj X-Received: by 2002:aa7:9ac4:: with SMTP id x4mr46922615pfp.43.1557920837398; Wed, 15 May 2019 04:47:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1557920837; cv=none; d=google.com; s=arc-20160816; b=YDl+yLfRZhmHs/9wEV63idDbTjTqMrfNLvQ2cl9EmS3J1DWM7v2VsLcI5m3QXYrMdh CrA6o0qQKYa0g2jPW8TDcu4hWSsTq39uyb5ADZVI5sRTYwMMhHt/hKSULqwZFqxNzK6o B+kCnqUN4tHfXs4t83tAkA3ixPeGdZvLYf2hoKUG0xCG/t3e0lrbJ+OhSeUh8qSOZ8yO rhhAdZinmoYMjvPnk9CBAFJkRtvk/6bxSyTUs+NWD0pQF5C0h1O33cQnSVff/aDUStSU UJ26TVBEdAAS0tDDwItRAfO90dkb7bVSEw0Rkxk2TsonNABDLcXh2aBmhBKeE6UXTVXX rSBg== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=CsS4XC7hsaneSRi5+xC0qCjumf0xTaYiQo5ToSN4HnA=; b=Y4/gLcePkDuTq7KWAZQDlOy0yoE3TmKmBqSdoKS4F+6Du2dZ8rbymJlJdt4BqXh9K6 znuz9aJ5mMv1QEB2AyHxw8JRuCBIbz7JhhdNewDNCyMxdii1bz2e1nwMnwjRbNXyJmG9 45uA8YbULY1jH/ATAuz1tOEXwRuGOAmpi85PuM9L9oPP0SL66ydhAzbP9xaJNzLE36Gl UskA3r4pgAiQkE+5Zrj80xmh89n4pFXxzIk8kgx2tivKquQEpI8cinuMMK4RYEfac7FJ vxjAojVm3PGMfoXv4gmeEAkjdRvts3Db04bYA6Lbuy+O8/HN+YHuV4PNNe4IclWkBb4B tgKw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=MYCiECqq; 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 b70si1898476pfj.166.2019.05.15.04.47.02; Wed, 15 May 2019 04:47:17 -0700 (PDT) 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=MYCiECqq; 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 S1732211AbfEOLo5 (ORCPT + 99 others); Wed, 15 May 2019 07:44:57 -0400 Received: from mail.kernel.org ([198.145.29.99]:37072 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731851AbfEOL0N (ORCPT ); Wed, 15 May 2019 07:26:13 -0400 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 321E62084F; Wed, 15 May 2019 11:26:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1557919572; bh=CERp3i2iLB2TEaVHKwjI6GCZatALGM64HOa2MbAtixU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=MYCiECqqCKyhIDyuwrOj9/ohcUQyLvY5UTK3ZZjX+S5xG8/QSGwiGpRpJsjil38PY 4zqrCnuAq88/TsxrbISan0gtf/zJzJDlfGEBL6iBT1QPUHWV9X/KDWYs2ieCHU5RTs J7g8iBbwhj6xse07BeIlKtKN7ekNYSeHoBk0hZdE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Sven Van Asbroeck , Jonathan Cameron , Sasha Levin Subject: [PATCH 5.0 013/137] iio: adc: xilinx: prevent touching unclocked h/w on remove Date: Wed, 15 May 2019 12:54:54 +0200 Message-Id: <20190515090654.305543987@linuxfoundation.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190515090651.633556783@linuxfoundation.org> References: <20190515090651.633556783@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 [ Upstream commit 2e4b88f73966adead360e47621df0183586fac32 ] In remove, the clock is disabled before canceling the delayed work. This means that the delayed work may be touching unclocked hardware. Fix by disabling the clock after the delayed work is fully canceled. This is consistent with the probe error path order. Signed-off-by: Sven Van Asbroeck Signed-off-by: Jonathan Cameron Signed-off-by: Sasha Levin --- drivers/iio/adc/xilinx-xadc-core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/iio/adc/xilinx-xadc-core.c b/drivers/iio/adc/xilinx-xadc-core.c index 15e1a103f37da..1ae86e7359f73 100644 --- a/drivers/iio/adc/xilinx-xadc-core.c +++ b/drivers/iio/adc/xilinx-xadc-core.c @@ -1320,8 +1320,8 @@ static int xadc_remove(struct platform_device *pdev) iio_triggered_buffer_cleanup(indio_dev); } free_irq(xadc->irq, indio_dev); - clk_disable_unprepare(xadc->clk); cancel_delayed_work_sync(&xadc->zynq_unmask_work); + clk_disable_unprepare(xadc->clk); kfree(xadc->data); kfree(indio_dev->channels); -- 2.20.1