Received: by 2002:a05:6622:f08:0:0:0:0 with SMTP id l8csp4480992ivc; Tue, 3 Nov 2020 13:09:35 -0800 (PST) X-Google-Smtp-Source: ABdhPJxDzQ98x8Oe0myG6MCjGW4cZrnCE2C9pibmrfnhAmw5IU7fjnzETNSArlC0xWhPjv8Gok0P X-Received: by 2002:a17:906:1e08:: with SMTP id g8mr21712571ejj.358.1604437775717; Tue, 03 Nov 2020 13:09:35 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1604437775; cv=none; d=google.com; s=arc-20160816; b=banhaeo6maK+j02EJe1OueTrWbdSJ7jIGatqQq/cDCCgGqHemMF6ImA9Ejx2iZw4QN OrT48ANB0cVw8gzjziM3pxFF6PL4PE0pOIPRAJ7+Wjc1mcRDIuY4shdriHVw3gE+uoAC rrr4jQ0JiK/DPI8kTANATsMvL0Y/1CpRQjmx8LJAy3fiy973+tto+5CkKtBGGkNPiQZb 7cdaqmkR0bbQjfEm/obWeVa2QSYrBOOl2ucP0fIrw/MrrOObmfdJ+wGpQSaXYZGgHAY+ Gc3zjsK9SNbbcSzlM1KmksmyNAQ99ldGXEAPSzdythE8RLzOkU6UXBLj4dylEl+nsF4a i1iQ== 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=wT6SQfWmc4MSRxeVl1GbT/CScjIjF5H4mcSxzt52UGk=; b=GrW0DYcm99n1WMgd2bdmdjz+FpIVVWG7dfJcJX2g8alrXzyjbjBQ343J5KKd0LLE/g JazIWQNAH2TvDXd5SshPb0n9d5Ojc913h/PTsbGjFVqT7exo8b5MZm3Zhx7pf+UCMA0G vSZXJ8JDT9SGKFXrlg4WFQPWq2tXp6MPgaglvh1ueYK+YHVG8WATOSBZjegQEvaA/HOQ +iCn0LgOy20Pj9iv0aXlPrJl/yeP1MgBWQSB9Ol8NMdOWLqERGrJq3JhOAuW/j/RkHoe KOzgPLwz4bDrcmut320sCT5xt55ZUl8LR+/60k8I4rksTRvJ0YXNmpdZ6lmyQYF0m7H2 NYDg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=zWZOMK2g; 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 dd12si1136445edb.382.2020.11.03.13.09.12; Tue, 03 Nov 2020 13:09:35 -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=zWZOMK2g; 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 S2388097AbgKCVGB (ORCPT + 99 others); Tue, 3 Nov 2020 16:06:01 -0500 Received: from mail.kernel.org ([198.145.29.99]:44742 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387901AbgKCVF7 (ORCPT ); Tue, 3 Nov 2020 16:05:59 -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 B186020757; Tue, 3 Nov 2020 21:05:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1604437559; bh=fGjYZi/Airc4VLiDnwcvtGBX6ePpexIK314X44oJnbE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=zWZOMK2g4ov2uq3abbmpRBjU+eeuAoPzZUmnB/gtgKnQRJ6gAa46/Dt2PZZKlk5nC Jw7f9DPI4wHRXRt/5jnBEcbtEODA37lSqFooSiFeYqcFh9xFrjOzRwmri/DjgOyGR3 H2kJrdy3UTiW+ykrFlr3R7dzXp/0eAKL15+NUfco= 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 4.19 090/191] bus/fsl_mc: Do not rely on caller to provide non NULL mc_io Date: Tue, 3 Nov 2020 21:36:22 +0100 Message-Id: <20201103203242.396561791@linuxfoundation.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201103203232.656475008@linuxfoundation.org> References: <20201103203232.656475008@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 7226cfc49b6fd..3f806599748a4 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