Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp3630493pxk; Tue, 29 Sep 2020 01:56:51 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxYexowmDxVFAz5C0+rtDQMT8LufFXZwXe4gUMJDim6nDD4gnmQiL+YsnS1q5NJ2U1+KdNw X-Received: by 2002:a50:f418:: with SMTP id r24mr2092606edm.295.1601369811073; Tue, 29 Sep 2020 01:56:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1601369811; cv=none; d=google.com; s=arc-20160816; b=cqIP64za1kPK9LoB6WVBH2V5FQLRsH5RqYoJfIAeDiaCSjCKakyN9cYQ8yEA4PfqAg omaVpHaiQDzEcgjRgCtuBCx61p7VkUsy1YvmNBgZtPh8hVxR7Ke0gf9kuvA1pOShuaIZ yqds5sM3/B9Tb+7ZHjxFkj9R4qfZ8XULmcqcTsaILEcgOoCY4LDofj0ASRpIrh9c4L3M HFNxSwBA7uUNXnaJ1LEMMtanBm4crbLjYHwFoJJ1kt510zSk09/i3B+9fdYa4aH5GOZZ s3tx2yUjaA9QxSguWBhbx/C/FtFhmagN9YDQzeWnW+4FOhqCjMkjk85IjHfYXOVaeCY8 WsWw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:references:in-reply-to:message-id:date:subject :cc:to:from; bh=hPyzOFFbpHxb2KLOOVT8iJu1A+a+zlhCxzMxeeGOZNY=; b=j8e0y9KzQ7MUOTiGbjOxELjiV4GSevZjGp6EzkFg3mtjBRyt1sMAw+7NKeLF3x0pwf YBnAzTkZZzTjgKQaVvuBnvXtPHQApDNiUiPbzTyQueG4Oq7pdYo+hCiUbautkihkfqe8 vc5LLIr4xRspWXXHdCJSvBg9sJKpkVcXydQZwq7xkLe1Avl5Bul6UJzSolK3g20mkdeh KVNMeB7rbKEk4nIfaB6V0xWXzImfyGkksnavj4FIcUQOvdQuzkLucotjH/XXPBGz88FJ /FbCvJsS5/sP14FMxJv7fpL7J3Dn07H4adTf+RfAqQwIW8B16LxMiM6h+ruTbxKQZ+Xm YJeA== 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 v5si2313958ejg.609.2020.09.29.01.56.28; Tue, 29 Sep 2020 01:56:51 -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 S1727774AbgI2IzM (ORCPT + 99 others); Tue, 29 Sep 2020 04:55:12 -0400 Received: from inva021.nxp.com ([92.121.34.21]:54004 "EHLO inva021.nxp.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727841AbgI2IzK (ORCPT ); Tue, 29 Sep 2020 04:55:10 -0400 Received: from inva021.nxp.com (localhost [127.0.0.1]) by inva021.eu-rdc02.nxp.com (Postfix) with ESMTP id ED94320160F; Tue, 29 Sep 2020 10:55:08 +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 E157B201625; Tue, 29 Sep 2020 10:55:08 +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 863702032C; Tue, 29 Sep 2020 10:55:08 +0200 (CEST) From: Diana Craciun To: linux-kernel@vger.kernel.org, laurentiu.tudor@nxp.com Cc: stuyoder@gmail.com, leoyang.li@nxp.com, gregkh@linuxfoundation.org, linux-arm-kernel@lists.infradead.org, Diana Craciun Subject: [PATCH v5 10/13] bus/fsl_mc: Do not rely on caller to provide non NULL mc_io Date: Tue, 29 Sep 2020 11:54:38 +0300 Message-Id: <20200929085441.17448-11-diana.craciun@oss.nxp.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200929085441.17448-1-diana.craciun@oss.nxp.com> References: <20200929085441.17448-1-diana.craciun@oss.nxp.com> X-Virus-Scanned: ClamAV using ClamSMTP 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 a30b53f1d87d..305015486b91 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