From patchwork Tue Nov 3 20:33:06 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg Kroah-Hartman X-Patchwork-Id: 317208 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 60589C388F9 for ; Tue, 3 Nov 2020 20:43:09 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 20776223BF for ; Tue, 3 Nov 2020 20:43:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1604436189; bh=C4vWTdQtFLrCe1HavvWLal4gIoXh6UkTw3EtsP2qTaw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=SGsOiDSUQzT5ODpdae5EUoc8I2iU5o3M4EsdwtSv5tmALljEV3roWeOCW603lXwv+ GqBTskdtqfPNEEavBP/KSDkIny5aXFiNjAxQb6Hu3hs8sxF08A7iir+ret4DSwP8a0 eC7ys20XTIP+2qfLjMbEEN35yeC+xA8lblOeGtes= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730623AbgKCUm7 (ORCPT ); Tue, 3 Nov 2020 15:42:59 -0500 Received: from mail.kernel.org ([198.145.29.99]:55974 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730108AbgKCUm7 (ORCPT ); Tue, 3 Nov 2020 15:42: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 5FCC12224E; Tue, 3 Nov 2020 20:42:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1604436177; bh=C4vWTdQtFLrCe1HavvWLal4gIoXh6UkTw3EtsP2qTaw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=x5pdykFPbsTg41J3BbQYdB7rw/OiBHuxziiA8B9OdfCo6aG+6sTo2J6mCZbAVK3sl X/Z1JeTj3uxeUGJ1AEwba/8BNW5FOWgg1j9vnK8i8tb5uc/Jn+h2M0ixLhslT6w0XF Wl/FX+brlq27soBLQuaWaFGhKhrBFFr0sLs2LOuA= 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.9 135/391] bus/fsl_mc: Do not rely on caller to provide non NULL mc_io Date: Tue, 3 Nov 2020 21:33:06 +0100 Message-Id: <20201103203355.939595689@linuxfoundation.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201103203348.153465465@linuxfoundation.org> References: <20201103203348.153465465@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: stable@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 a30b53f1d87d8..305015486b91c 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);