Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp126985ybt; Mon, 6 Jul 2020 05:45:05 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxKSqPohC4Tc5gGuRYlKJj228yDykRIcxnb8non4AdSgJimcjZmVnNx0nqj3YzipA0AtaEq X-Received: by 2002:a05:6402:b1a:: with SMTP id bm26mr54362191edb.144.1594039505604; Mon, 06 Jul 2020 05:45:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1594039505; cv=none; d=google.com; s=arc-20160816; b=iAjWMfc8I7wWVrcvj21h2Znou65lV7Dsr6zA0y53PbxrLKQ3K1gDVLB3UP7spSaowx jbSe+ZYruNy9kKrKMbjo1YtNCimLFXtnPEXnqMWAX4gTnGz+SmZs93KZRiE3MtFC1vIV f+PWExNY/LFhSBB29Jux7CFAJDH73QCVMqPAubytZVUPOYFjZLbqPI7PKxg2QE4IYqfF vniQhlBNlWHGD9kZWvebBYqmZeqybK319LpynaoDxAtvRi9RujeXbf5+JeIVWTj3VNe1 GsoA4fkT67yp38qmt5WV2kgiPMyTXff9Z1TjqngKQxnTFWLkJHJ5SvLAIhSUIF+J/3mn YtXw== 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=okZgX3+sMK9yKDjZTAcIIUUr+xI4UrA6qRyS9Gjjh9E=; b=Cd2DjQy9WQB5PlwHqRcR0yPJrg9u8BuRNLiLH69Bc+GJ+30GdzCtNyWbNRGPlw1zUx rR1g4UA2oR2oIvsWTY1+QksHbdpsl6pvnaeZQ3USSa5/3OL/cS39lkb/skeAy0VPWUVY D0bekWHagUv9hFIvf47nYKBVzgUrtEbJqmL3ty3w3SW+Izy9p2Bdp/SFDf5JPZ2iLUa5 m50QI8onTIAy8Pigfob3YPiILtofZOHEpx7CEAjgAir1vdV+UGMBWMT0fqknnj2zNbUg GeJECdnOJWMOostf5zrqm31rMKCNKdnYOBKTgrpDcTCbMciYjWzqa6gER1fxwix2HEs8 pBSw== 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 h16si12792072ejb.456.2020.07.06.05.44.43; Mon, 06 Jul 2020 05:45:05 -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 S1729260AbgGFMnq (ORCPT + 99 others); Mon, 6 Jul 2020 08:43:46 -0400 Received: from inva020.nxp.com ([92.121.34.13]:42796 "EHLO inva020.nxp.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729178AbgGFMnK (ORCPT ); Mon, 6 Jul 2020 08:43:10 -0400 Received: from inva020.nxp.com (localhost [127.0.0.1]) by inva020.eu-rdc02.nxp.com (Postfix) with ESMTP id 1F4A81A06B9; Mon, 6 Jul 2020 14:43:09 +0200 (CEST) Received: from inva024.eu-rdc02.nxp.com (inva024.eu-rdc02.nxp.com [134.27.226.22]) by inva020.eu-rdc02.nxp.com (Postfix) with ESMTP id 1239B1A06B7; Mon, 6 Jul 2020 14:43:09 +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 A4A8B203C3; Mon, 6 Jul 2020 14:43:08 +0200 (CEST) From: Diana Craciun To: linux-kernel@vger.kernel.org, laurentiu.tudor@nxp.com, gregkh@linuxfoundation.org Cc: stuyoder@gmail.com, leoyang.li@nxp.com, linux-arm-kernel@lists.infradead.org, bharatb.linux@gmail.com, Diana Craciun Subject: [PATCH v3 10/13] bus/fsl_mc: Do not rely on caller to provide non NULL mc_io Date: Mon, 6 Jul 2020 15:42:40 +0300 Message-Id: <20200706124243.10697-11-diana.craciun@nxp.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200706124243.10697-1-diana.craciun@nxp.com> References: <20200706124243.10697-1-diana.craciun@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 From: Diana Craciun 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