Received: by 2002:a05:6a10:9e8c:0:0:0:0 with SMTP id y12csp627019pxx; Mon, 26 Oct 2020 17:21:35 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzCCpVxaiX0/6ai3IIuqjqRRmuttG317ibzMf9Q4UVwiYA3SoVb/4pme+35GMEQu1YaehKq X-Received: by 2002:a17:907:2714:: with SMTP id w20mr19283352ejk.515.1603758095044; Mon, 26 Oct 2020 17:21:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1603758095; cv=none; d=google.com; s=arc-20160816; b=rl+s+qBP9IhvsuH2WoHPpiUlejqZp4Ye86eLRxLd9u97qC6GPP6ni1zEBNiBzCSHBT VINuXV1MbNWvfKYB4IwhfT78KpN9s+znhSFvHL87hptJGpg5yyuPpHXGrTb4NIlxQ7OD 288dxyLTul+fUYxfagu++Pqr+7yYvPBDqBOcOhg2u1Fu8JXHZaFqQCzA+9EJ4Gzee/3x nwotcNYVFlrJgFdnbqykwH/ZM2m4eJp1/LRJ/jYeP0aFT8GrQvKLEMya+qrruqR9DpkZ 2PBK4jaKFdlS3p1hRBeSNtshZ2E0msW4vAwICLCb+yyXudBCNqJ1i6I5bilan6GZjMvn OQkg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=EJZrN8e8FbEElSc3Heujiub8vMaRuOwmZj7SdLDKTQA=; b=J4uizzADPZ22jHG+7b4gnCJvp3fCLAlkCqBdUW2USVkEGRUtuJgZlMebN6RE9W8rmG XBxUlRgMcNNEtssMzqCPIdOqR8lGXqmuXbrvJLD+9PErdDml3QQHsCYZBD44/BT11qWx f4S58lA1cwRiYN9JXY6uuMh3Q2gAdcR77foIHI2/7XzbSgxyJBt7bEpqX5Dsridh2K7d 4qlYLc7Az5v+EKVTt/gs8zGXnP76hfphkENZ9yMcHDu1x05ohVA+k/JjYryanzHlxb74 mZ0F1WS6+oeun8Iwhe4j97KMMqIV3zElDsk//LW1pNzz82J5JfaVehXqWqYFPshMD+s4 ux0w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=noRU2BeL; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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. [23.128.96.18]) by mx.google.com with ESMTP id k11si8333036edn.156.2020.10.26.17.21.13; Mon, 26 Oct 2020 17:21:35 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=noRU2BeL; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 S2437391AbgJ0AB7 (ORCPT + 99 others); Mon, 26 Oct 2020 20:01:59 -0400 Received: from mail.kernel.org ([198.145.29.99]:35838 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2411098AbgJZX4S (ORCPT ); Mon, 26 Oct 2020 19:56:18 -0400 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 7755A2225C; Mon, 26 Oct 2020 23:56:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1603756578; bh=Q5DGLxq+3nswD+SGP9Rs0t9yRliV69TmKXAPhbAHYYU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=noRU2BeL5JkGNUj2q+oKQFsNrxOL/YPCvtvb5rEKVjpwi4sGAywxQsl/ZM9hcystv YwUNJJR9mUp5YYBWi44RoslZ44UnJrgqy9GESzZ54fIbF+0oF9j+RaTiPNy+ISoWs8 1aQUgFwjGPtr+gfp5Gz8KKkisc7HrrJG9k2LHE3g= From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Diana Craciun , Laurentiu Tudor , Greg Kroah-Hartman , Sasha Levin Subject: [PATCH AUTOSEL 5.4 51/80] bus/fsl_mc: Do not rely on caller to provide non NULL mc_io Date: Mon, 26 Oct 2020 19:54:47 -0400 Message-Id: <20201026235516.1025100-51-sashal@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20201026235516.1025100-1-sashal@kernel.org> References: <20201026235516.1025100-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Diana Craciun [ Upstream commit 5026cf605143e764e1785bbf9158559d17f8d260 ] Before destroying the mc_io, check first that it was allocated. Reviewed-by: Laurentiu Tudor Acked-by: Laurentiu Tudor Signed-off-by: Diana Craciun Link: https://lore.kernel.org/r/20200929085441.17448-11-diana.craciun@oss.nxp.com Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin --- drivers/bus/fsl-mc/mc-io.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/drivers/bus/fsl-mc/mc-io.c b/drivers/bus/fsl-mc/mc-io.c index d9629fc13a155..0a4a387b615d5 100644 --- a/drivers/bus/fsl-mc/mc-io.c +++ b/drivers/bus/fsl-mc/mc-io.c @@ -129,7 +129,12 @@ int __must_check fsl_create_mc_io(struct device *dev, */ void fsl_destroy_mc_io(struct fsl_mc_io *mc_io) { - struct fsl_mc_device *dpmcp_dev = mc_io->dpmcp_dev; + struct fsl_mc_device *dpmcp_dev; + + if (!mc_io) + return; + + dpmcp_dev = mc_io->dpmcp_dev; if (dpmcp_dev) fsl_mc_io_unset_dpmcp(mc_io); -- 2.25.1