Received: by 2002:ac0:946b:0:0:0:0:0 with SMTP id j40csp208343imj; Thu, 14 Feb 2019 18:43:46 -0800 (PST) X-Google-Smtp-Source: AHgI3IY9WnhqO+utzhmfn/zg/y54GPUGtze+7LOa2+FrpOK4Hoc0/MoSO2OzgWqQvWZLVLIIOndL X-Received: by 2002:a17:902:b902:: with SMTP id bf2mr4796543plb.286.1550198626104; Thu, 14 Feb 2019 18:43:46 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1550198626; cv=none; d=google.com; s=arc-20160816; b=bdsYutAv99D6mP2Oa7mIPdnu2/u8hmQ3U2rABethazt0Nq0G4uC7/nYUDjO9r6kPxl e4nSZoegkKhKuI4vAqqs+2T/pIwH1LmAUfxwbdpvPDSeyYpdgpa33Tpqyio/OGl73fdD rGv25MDEEiIcT6tg7V9ejZFtRUEXFwjbbd5uYf3NLBpqMtZ8hb6xoP41+VshA9iaSBvr rlLKrmtwt3rcbL7OGZYJbBQW+gRmlLhY7ljFwy9fxxiqEeCXGIG6eA0qa3rLu+3tMR2q Ml8CWIP/J2uSSCv+lS5k1vYn1JZmwHVJIhNd+gXPSLN+zeberDospLmsqoUMWvrgxa3m LWsQ== 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=bvpXrZZZnKnOM6Da5CZgvLDRk214Tpo2Snx7jwfCW1g=; b=DyoYxzEWbwf7GDEqok0snifZZWBoHJMrY3GH95tK2LySS/rF3Yu/17Muq9E60l4nSX JYejHpARJYPl3Q3VeF4/Y2D7TEfBV3V5IPc/yjkekcvC8DNcOqhTXn2LlcYf/wvgCYp5 3F36m8f/P3vko1rR/iOWPNzlS6pHhjBCzbrlyQPCP2AFESFvOCqH+ac1k61rHzwP2wJd o8+THEHb0Zo2uOq1HuR7+L2ixVIpiKjJuZiteigKnsBI6qrkwl++NY7Cvf+G9Pfqf5rc sd5HEmOZIhKGXysvTc5IJr6XkP/58Z7KxoZAICqZmcRk+ZJVW4j6aioJqlVtHquSttCI dTeQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=NPlXVMDG; 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 b1si3990131pgw.288.2019.02.14.18.43.30; Thu, 14 Feb 2019 18:43:46 -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=NPlXVMDG; 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 S1731567AbfBOCJL (ORCPT + 99 others); Thu, 14 Feb 2019 21:09:11 -0500 Received: from mail.kernel.org ([198.145.29.99]:49330 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731501AbfBOCJH (ORCPT ); Thu, 14 Feb 2019 21:09:07 -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 2AAFA222A1; Fri, 15 Feb 2019 02:09:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1550196547; bh=XX8gkTWfydJ2h2LV3tckAphKi35817hiwi8/g5LwD/U=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=NPlXVMDGxp6gZcK5A+5KQdK3vLNCFHrfnuKAAD9MkQcAniv4N/BPl9mnDLBfznlmh xPEBtFb+BFpI0CWitpgKRoN89PClMDtiScmnsJdSL0EUYamgQYQVqevc2WLuxZOydX aTCX7Ly9AaK+wKPxJUMCilsQyUfU7ERmk+ur/XWk= From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Dan Carpenter , Stephen Boyd , Sasha Levin , linux-clk@vger.kernel.org, linux-tegra@vger.kernel.org Subject: [PATCH AUTOSEL 4.20 07/77] clk: tegra: dfll: Fix a potential Oop in remove() Date: Thu, 14 Feb 2019 21:07:45 -0500 Message-Id: <20190215020855.176727-7-sashal@kernel.org> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20190215020855.176727-1-sashal@kernel.org> References: <20190215020855.176727-1-sashal@kernel.org> MIME-Version: 1.0 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: Dan Carpenter [ Upstream commit d39eca547f3ec67140a5d765a426eb157b978a59 ] If tegra_dfll_unregister() fails then "soc" is an error pointer. We should just return instead of dereferencing it. Fixes: 1752c9ee23fb ("clk: tegra: dfll: Fix drvdata overwriting issue") Signed-off-by: Dan Carpenter Signed-off-by: Stephen Boyd Signed-off-by: Sasha Levin --- drivers/clk/tegra/clk-tegra124-dfll-fcpu.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/clk/tegra/clk-tegra124-dfll-fcpu.c b/drivers/clk/tegra/clk-tegra124-dfll-fcpu.c index 269d3595758b..edc31bb56674 100644 --- a/drivers/clk/tegra/clk-tegra124-dfll-fcpu.c +++ b/drivers/clk/tegra/clk-tegra124-dfll-fcpu.c @@ -133,9 +133,11 @@ static int tegra124_dfll_fcpu_remove(struct platform_device *pdev) struct tegra_dfll_soc_data *soc; soc = tegra_dfll_unregister(pdev); - if (IS_ERR(soc)) + if (IS_ERR(soc)) { dev_err(&pdev->dev, "failed to unregister DFLL: %ld\n", PTR_ERR(soc)); + return PTR_ERR(soc); + } tegra_cvb_remove_opp_table(soc->dev, soc->cvb, soc->max_freq); -- 2.19.1