Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp830479pxb; Tue, 3 Nov 2020 13:47:13 -0800 (PST) X-Google-Smtp-Source: ABdhPJzWJDQRnqxORfmVG9/xLT26MxMhr7SzRzUHr+LTDMHh9Fsfn8t0xRidgSbtXks2EnRUPQnW X-Received: by 2002:a17:906:d8b0:: with SMTP id qc16mr21559541ejb.268.1604440032737; Tue, 03 Nov 2020 13:47:12 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1604440032; cv=none; d=google.com; s=arc-20160816; b=lUg6yN3CB9Zkx+eheabZi0LQf1j3pxeZx90L8NivN3xf6u3R2kqjuC61dhiDFhrb/c i8RdMK2PEOcfK5/wACmTBBsROvO+m3u0LUrFnen1FKyHgvE5KnIiM9Ru2wn5CAVljsRf oBMm/kxOImxcDIqLvlcfUtKMU/maspDRPPTHZODATkBbPvoiEVNoPiZp/ZAb8cwfDn/m bJtONdlGUqObfOICSYWf9nJsrz45ohy/MVA0d3Id/D7HkEwPXyWz7SiAZdoaX0LKAAH0 M+ue/lcpIwuxjDIYJWApF5+KOC9utCOChhMfRmFnNtDy8JNyIfFN4tmzOk8jQCMh8lZC jGhw== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=QVs9Dj0dKRNlmy1WTbydqH0abZxmb+PiuM1OsEslqkI=; b=tL3Tb86w54+wMgE99nK6pJyBtzSplxMXG8013cfwRbQyvW4yfEX3M8kR6D4Ho0bHuI MGgJRUtKQ/BEFWCgZYYIfVYYw6u0/Exs6+hJ2+EMPwDHOZN0UBv+6/j37eLcxTmf1Fgg b3wXp1iVH3xhC3S/sJEfVXKiK0UFavWCgTj5j3vrNbRfLSLcxQO8bWWZiCWbG3se+7fr fRb8ruPRKfKNCULQxkJMsgIhmaqo1DsyjhHX+TuZYroZhHa+8uxuv0DQa+XS7q2hMd/f Ix9skdDYCVasxPOnr4CEKLkeLbxJCkeiuKd/BcvKy2eEViQu1SG8oj3wO0ATgtxv/WHK NI4A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=1ra81Swi; 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=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id g9si15085120edn.361.2020.11.03.13.46.49; Tue, 03 Nov 2020 13:47:12 -0800 (PST) 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=1ra81Swi; 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=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732918AbgKCVml (ORCPT + 99 others); Tue, 3 Nov 2020 16:42:41 -0500 Received: from mail.kernel.org ([198.145.29.99]:55796 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732297AbgKCUzW (ORCPT ); Tue, 3 Nov 2020 15:55:22 -0500 Received: from localhost (83-86-74-64.cable.dynamic.v4.ziggo.nl [83.86.74.64]) (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 CCF3522226; Tue, 3 Nov 2020 20:55:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1604436922; bh=e5qaUHjEWIzuyNHRajnjBOEZsfY+VdVgaSrrFJxbuVM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=1ra81SwisF39/XovKIVU7en4a4M0PoDosc4WBJLCv7DjwD1fIuqrsThQ51NiH56ee MnYXdo/ev5DDCQa9hui7FoXUBklIUBuvLnB6onlzll1qe8g715dFu2mjfXmP1ErvWW hs9pWj/OSCkfPRYO2Gtd8ZGUkaai4uQWbebOkKG8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Laurentiu Tudor , Diana Craciun , Sasha Levin Subject: [PATCH 5.4 068/214] bus/fsl_mc: Do not rely on caller to provide non NULL mc_io Date: Tue, 3 Nov 2020 21:35:16 +0100 Message-Id: <20201103203256.768056644@linuxfoundation.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201103203249.448706377@linuxfoundation.org> References: <20201103203249.448706377@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 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 @@ error_destroy_mc_io: */ 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.27.0