[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20200706124243.10697-11-diana.craciun@nxp.com>
Date: Mon, 6 Jul 2020 15:42:40 +0300
From: Diana Craciun <diana.craciun@....com>
To: linux-kernel@...r.kernel.org, laurentiu.tudor@....com,
gregkh@...uxfoundation.org
Cc: stuyoder@...il.com, leoyang.li@....com,
linux-arm-kernel@...ts.infradead.org, bharatb.linux@...il.com,
Diana Craciun <diana.craciun@....nxp.com>
Subject: [PATCH v3 10/13] bus/fsl_mc: Do not rely on caller to provide non NULL mc_io
From: Diana Craciun <diana.craciun@....nxp.com>
Before destroying the mc_io, check first that it was
allocated.
Signed-off-by: Diana Craciun <diana.craciun@....nxp.com>
---
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
Powered by blists - more mailing lists