mhi: core: Add NULL check in debugfs show callback
Upon external soc power down mhi controller context pointer is set to NULL. If debugfs query is issued at that time it results into NULL pointer dereference. Fix the issue by adding a NULL check in debugfs show callback for event and channel. Change-Id: I8c947bc6c42e80c625bf06c17e73368d2195a2bb Signed-off-by: Hemant Kumar <hemantk@codeaurora.org>
This commit is contained in:
parent
96cd181257
commit
1092885dc8
@ -1,5 +1,5 @@
|
||||
// SPDX-License-Identifier: GPL-2.0-only
|
||||
/* Copyright (c) 2018-2019, The Linux Foundation. All rights reserved. */
|
||||
/* Copyright (c) 2018-2020, The Linux Foundation. All rights reserved. */
|
||||
|
||||
#include <linux/debugfs.h>
|
||||
#include <linux/device.h>
|
||||
@ -2038,6 +2038,9 @@ int mhi_debugfs_mhi_event_show(struct seq_file *m, void *d)
|
||||
|
||||
int i;
|
||||
|
||||
if (!mhi_cntrl->mhi_ctxt)
|
||||
return -ENODEV;
|
||||
|
||||
seq_printf(m, "[%llu ns]:\n", sched_clock());
|
||||
|
||||
er_ctxt = mhi_cntrl->mhi_ctxt->er_ctxt;
|
||||
@ -2071,6 +2074,9 @@ int mhi_debugfs_mhi_chan_show(struct seq_file *m, void *d)
|
||||
struct mhi_chan_ctxt *chan_ctxt;
|
||||
int i;
|
||||
|
||||
if (!mhi_cntrl->mhi_ctxt)
|
||||
return -ENODEV;
|
||||
|
||||
seq_printf(m, "[%llu ns]:\n", sched_clock());
|
||||
|
||||
mhi_chan = mhi_cntrl->mhi_chan;
|
||||
|
Loading…
Reference in New Issue
Block a user