Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp3515719pxa; Wed, 26 Aug 2020 02:29:22 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxyCJ+FbHWViSpTCJrBboLRDKFdN/sODwcju+p9B5zZ8jrVgGXY8T2KMewIaDb1bIQcqgEZ X-Received: by 2002:a50:9358:: with SMTP id n24mr14359713eda.7.1598434162504; Wed, 26 Aug 2020 02:29:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1598434162; cv=none; d=google.com; s=arc-20160816; b=060YuG1Ih4NqPcP73sKiD3q7wv1lx5aidedsXrME9UppOVKmeYkMUky4zNG4MVCFCK mlAuepxbCbe4bINUequg9dq3+Ifj7wavxa1BPtHveyEZERpBKxK39u09Rda4ML82RoGB kq8wxZPETPlJAW3V4eUSmErONHuYPWMbzHmEIiQIATG78mzhqyeBFyaporvZBqXScsf6 yfWnVobHlfE5TmZalJCkvLOKGEPNkuhn1jkuns14Ismf5UHom66BWvbL0Aa6XXwT9mmO URlDlLZdiZ3wRON4Nehk/PV0GmFDhYX/lcOyHXTH+hldBJF7TydGOU0OlFYn6/S8aS7g +aTw== 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=hPyzOFFbpHxb2KLOOVT8iJu1A+a+zlhCxzMxeeGOZNY=; b=0irCD3eNIOer52op0PzpUPx6HHpyM1m/a3L5TxxMdx2e511xxkYk7ZhKjWRqDYo1yX oe9eukJFkiaXc4PkEagm/RFwTuIr5w2Y+XqoGvF6FIGhnCcCQNYauAqFz458tqraKgjF wPt7zxl9RlhyQy4BUyZG8y/IuP45e4WUcigVayxX52kCoZnbOa3PYLfvtIpQpR6ADnmg kn842OnI0pF6CpWyPjQ/Au7VMZ8/83qodnxOKEElgvgjV/8RFEsckB8okqPXt6va8g9F LKN9Ciqg/88nRFxgnUVY1xdaufl8BKWyjPKKy0uwx15Yb9kB/KYDEHxF8iOyMIKNP2KM V08w== 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 i15si1172412ejy.710.2020.08.26.02.28.59; Wed, 26 Aug 2020 02:29:22 -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 S1728193AbgHZJ1V (ORCPT + 99 others); Wed, 26 Aug 2020 05:27:21 -0400 Received: from inva020.nxp.com ([92.121.34.13]:56494 "EHLO inva020.nxp.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728000AbgHZJ0J (ORCPT ); Wed, 26 Aug 2020 05:26:09 -0400 Received: from inva020.nxp.com (localhost [127.0.0.1]) by inva020.eu-rdc02.nxp.com (Postfix) with ESMTP id 6502C1A1559; Wed, 26 Aug 2020 11:26:06 +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 5889E1A08B7; Wed, 26 Aug 2020 11:26:06 +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 EF3FA202CA; Wed, 26 Aug 2020 11:26:05 +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, bharatb.linux@gmail.com, Diana Craciun Subject: [PATCH v4 10/13] bus/fsl_mc: Do not rely on caller to provide non NULL mc_io Date: Wed, 26 Aug 2020 12:25:24 +0300 Message-Id: <20200826092527.4992-11-diana.craciun@oss.nxp.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200826092527.4992-1-diana.craciun@oss.nxp.com> References: <20200826092527.4992-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 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