From 9560aea4e9d17cb75113c6051e800222fd5c71a4 Mon Sep 17 00:00:00 2001 From: Grant Likely Date: Sat, 22 Mar 2008 14:41:05 +1100 Subject: [POWERPC] mpc5200: Fix null dereference if bestcomm fails to initialize If the bestcomm initialization fails, calls to the task allocate function should fail gracefully instead of oopsing with a NULL deref. Signed-off-by: Grant Likely Signed-off-by: Paul Mackerras --- arch/powerpc/sysdev/bestcomm/bestcomm.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'arch/powerpc/sysdev/bestcomm/bestcomm.c') diff --git a/arch/powerpc/sysdev/bestcomm/bestcomm.c b/arch/powerpc/sysdev/bestcomm/bestcomm.c index f589999361e0..b18cab55a76d 100644 --- a/arch/powerpc/sysdev/bestcomm/bestcomm.c +++ b/arch/powerpc/sysdev/bestcomm/bestcomm.c @@ -52,6 +52,10 @@ bcom_task_alloc(int bd_count, int bd_size, int priv_size) int i, tasknum = -1; struct bcom_task *tsk; + /* Don't try to do anything if bestcomm init failed */ + if (!bcom_eng) + return NULL; + /* Get and reserve a task num */ spin_lock(&bcom_eng->lock); -- cgit v1.2.3-59-g8ed1b