From aaa34a1735bbafef5ba42dda88e67c3adbe23aff Mon Sep 17 00:00:00 2001 From: Laura Abbott Date: Tue, 14 Feb 2012 15:48:47 -0800 Subject: [PATCH] msm: rtb: Separate initialization from enablement The buffers for rtb are not set up immediately at boot time. If a client tries to log into the buffer before these are set up, rtb quietly exits. If enable is set on the command line, rtb will try to log before the buffer is set up, causing crashes. Fix this by creating a separate initialized variable to indicate when the rtb buffer is set up. Change-Id: Ia038347cd4b389cd0c82ac308c632404e000b17c Signed-off-by: Laura Abbott --- arch/arm/mach-msm/msm_rtb.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/arch/arm/mach-msm/msm_rtb.c b/arch/arm/mach-msm/msm_rtb.c index 6e79dfe70dd..3f56d1a3676 100644 --- a/arch/arm/mach-msm/msm_rtb.c +++ b/arch/arm/mach-msm/msm_rtb.c @@ -54,6 +54,7 @@ struct msm_rtb_state { int nentries; int size; int enabled; + int initialized; uint32_t filter; int step_size; }; @@ -66,6 +67,7 @@ static atomic_t msm_rtb_idx; struct msm_rtb_state msm_rtb = { .filter = 1 << LOGK_LOGBUF, + .enabled = 1, }; module_param_named(filter, msm_rtb.filter, uint, 0644); @@ -73,7 +75,7 @@ module_param_named(enable, msm_rtb.enabled, int, 0644); int msm_rtb_event_should_log(enum logk_event_type log_type) { - return msm_rtb.enabled && + return msm_rtb.initialized && msm_rtb.enabled && ((1 << log_type) & msm_rtb.filter); } EXPORT_SYMBOL(msm_rtb_event_should_log); @@ -217,7 +219,7 @@ int msm_rtb_probe(struct platform_device *pdev) #endif - msm_rtb.enabled = 1; + msm_rtb.initialized = 1; return 0; }