Received: by 2002:a25:23cc:0:0:0:0:0 with SMTP id j195csp505771ybj; Thu, 7 May 2020 00:40:21 -0700 (PDT) X-Google-Smtp-Source: APiQypJJAqrCOkMzfbPgDdTuKEtTN8/5J0+bzqjd57Ew4j6SpQH7SraIQTqxwH4iEsOdL6sow2hF X-Received: by 2002:a17:906:138c:: with SMTP id f12mr11055829ejc.35.1588837220973; Thu, 07 May 2020 00:40:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1588837220; cv=none; d=google.com; s=arc-20160816; b=J5AA/xP5YrHH64GvYtYru01EmHlfoE52l4t76SujPEsyVd2gwKSdMowMygg2pHGk3h ucBH+zBKAYr1Q0mmv87mx4sfKU+PeS/XVvHtHU2FKfRv8cMdO2L5nBq1JTs+63J3MZR8 lOZFUtaXF94qq+iSe+Ki+ee2Ki2AtC6xW/ml28P8t403aSf3J0/i+FhfKMOUm0FYue6Z KokThgnYqaKoHgyJ/28oLzJYrMdH2KnCF5jN5fmjd4Jyn1Drd6Zq0xUM1TpTYwQYQzsG AjrzDFTU/slH6AuhXn9WfZuC8dJxkyEInontPHgpHCoIZUBjQTb//0Z3DWDU+hiY/xxY iqmw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from; bh=ZurClT6lQorZij9UugsP40bxN5Z7HI3jjhafgFT9rwU=; b=1BDSfxoFTy+ZPQdQKKXcx+jct/w3b7I8mb2HIp2pBOtyaurhYLURyfqpHk1I+BrydS qUK+efAZR6I+dblcW0CJpTprK7xRImnuh0z7mhZhdeb8bj8ep3T/cYvLj6qLj+D1RbAb FIG8ThMYXD5jdDDlYdevN3ooJDsudukkZeHzjuiCKFWGkSJMj0dRAE47GsBHe3rvCJOh Jzyi39GgTf4FPHwb4xMPWUFSujBlC+cRmR050gj6mrTYdhDDHgpOAvQXq6o7vxc1FYv7 6+4tZhRzQ+5SdDC6rqMnLDBe9rwO4tFMZXkLax1vYnPrYhbKa/K5GG6m1E9jbhayu4ca DbSA== ARC-Authentication-Results: i=1; mx.google.com; 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=nxp.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id cq7si2459699edb.319.2020.05.07.00.39.58; Thu, 07 May 2020 00:40:20 -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; 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=nxp.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726690AbgEGHgI (ORCPT + 99 others); Thu, 7 May 2020 03:36:08 -0400 Received: from inva021.nxp.com ([92.121.34.21]:50240 "EHLO inva021.nxp.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726356AbgEGHfs (ORCPT ); Thu, 7 May 2020 03:35:48 -0400 Received: from inva021.nxp.com (localhost [127.0.0.1]) by inva021.eu-rdc02.nxp.com (Postfix) with ESMTP id 46113200F14; Thu, 7 May 2020 09:35:47 +0200 (CEST) Received: from inva024.eu-rdc02.nxp.com (inva024.eu-rdc02.nxp.com [134.27.226.22]) by inva021.eu-rdc02.nxp.com (Postfix) with ESMTP id 35339200F10; Thu, 7 May 2020 09:35:47 +0200 (CEST) Received: from fsr-ub1864-111.ea.freescale.net (fsr-ub1864-111.ea.freescale.net [10.171.82.141]) by inva024.eu-rdc02.nxp.com (Postfix) with ESMTP id D1793203C5; Thu, 7 May 2020 09:35:46 +0200 (CEST) From: Diana Craciun To: linux-kernel@vger.kernel.org Cc: laurentiu.tudor@nxp.com, stuyoder@gmail.com, leoyang.li@nxp.com, linux-arm-kernel@lists.infradead.org, gregkh@linuxfoundation.org, Diana Craciun Subject: [PATCH v2 10/12] bus/fsl_mc: Do not rely on caller to provide non NULL mc_io Date: Thu, 7 May 2020 10:34:29 +0300 Message-Id: <20200507073431.2710-11-diana.craciun@oss.nxp.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200507073431.2710-1-diana.craciun@oss.nxp.com> References: <20200507073431.2710-1-diana.craciun@oss.nxp.com> X-Virus-Scanned: ClamAV using ClamSMTP Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Before destroying the mc_io, check first that it was allocated. Signed-off-by: Diana Craciun --- 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 6ae48ad80409..e1dfe4a76519 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.17.1