Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp3211864pxb; Mon, 9 Nov 2020 05:43:15 -0800 (PST) X-Google-Smtp-Source: ABdhPJzkAdhf1ESuZvwSp1RfXFBOQyDiDE8ZqSVa7FGc0sZ/3MY9jqh/sanMc6aLthoiuoPsDGoT X-Received: by 2002:a17:906:660b:: with SMTP id b11mr15475167ejp.190.1604929395233; Mon, 09 Nov 2020 05:43:15 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1604929395; cv=none; d=google.com; s=arc-20160816; b=sNIoxKoYhwmZ+9XykQ/b3GqbatVoIFgrziXCqYKwxQpQNM/OzLyCnXRkZWKK/+fhbu yoQ/mSPMoCps9meQyu7VUPC+56JQbzLECg/5+tADuUB5GCvYSSMaqf5FRXi28V+Y8jdA AH0TkWDvfJ0HI7CyX/sKOtsEsGJaLfCIUPIlafT/vW0Pu9kJYq1H4VlLHgZocCHgPkYV u/eIoxOxWVdm3ppsZ0/qcQMKDfRFYGGn2ZJj0ofBZS5NaXS49H4imUwjn7hbsPKDlaIU Ps2pVGXg4z09IrGI//BOPNEP/CdvrceL1pAGhQYzHdFqrSOKgq6p2kVlIVv/THHi9L6Y 33wQ== 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=vViQOw2GzCr0b9FV0iXTz9+DQF16fSAQNxQ8RngHf8E=; b=a4l399dkvhFMVhhiDKAlSvR5sjKYneDSeK9rbHO6DmYQ2gS9cOYrWEd//ipJWevmwc suDYzTXsaJ92IwlpJUsK4Mza7el8C9aJu/dBFALHrwJVxS0GtmqB4uSJjWhkIzgRlaKm UbU2Oh077dCCUaQdwm25RwjAJm8Vh12eNCH3ufvGCGcgxX71D+1MZUp7mx2xADPVLOJS wk+QXiMRQpsaiETVBfkAA622zJ0+qxmSO8pl0TMRXxfq4ndw+C5hS+3xYDr7SN7NM3C4 k8Qv9wTUPPVqSh+1zaBNftVvNQrEi2a76cFAnU0WYUN5QunQlPW7ztgJAg7AiOMI6OYy Q52A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="i118T/4V"; 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 g9si6976215edp.146.2020.11.09.05.42.48; Mon, 09 Nov 2020 05:43:15 -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="i118T/4V"; 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 S1729499AbgKINBq (ORCPT + 99 others); Mon, 9 Nov 2020 08:01:46 -0500 Received: from mail.kernel.org ([198.145.29.99]:55246 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729915AbgKINBO (ORCPT ); Mon, 9 Nov 2020 08:01:14 -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 80E8920789; Mon, 9 Nov 2020 13:01:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1604926873; bh=yuG3T6Ln/e4soeu1ihs1+gRc7rN45GBOxQVfLswIqLk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=i118T/4VWscQYNoEvYSzt9YPKWy1kTfy2h39pOe7p7Qd6z/bcTLdHF70x4Xo4rBRA 0EsP/rCHTLSFJXujSVY5hSG2VKUXw/Ufw0VslYx6cpl3/EEkimCpy2iHu0NXaohnbG 8BxFp7nOqQZcdrPt9A9lK03uZJXhwfJHiwQbf10k= 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.9 033/117] bus/fsl_mc: Do not rely on caller to provide non NULL mc_io Date: Mon, 9 Nov 2020 13:54:19 +0100 Message-Id: <20201109125027.221741848@linuxfoundation.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201109125025.630721781@linuxfoundation.org> References: <20201109125025.630721781@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/staging/fsl-mc/bus/mc-io.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/drivers/staging/fsl-mc/bus/mc-io.c b/drivers/staging/fsl-mc/bus/mc-io.c index 798c965fe2033..3fa6774946fae 100644 --- a/drivers/staging/fsl-mc/bus/mc-io.c +++ b/drivers/staging/fsl-mc/bus/mc-io.c @@ -167,7 +167,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