coresight: return error if null or error is passed to coresight_register

Fail coresight_register if invalid (error or null) argument is
passed to avoid crashes.

Change-Id: I6c39ba2b81333f24480fdf5b348934651e095be5
Signed-off-by: Pratik Patel <pratikp@codeaurora.org>
diff --git a/drivers/coresight/coresight.c b/drivers/coresight/coresight.c
index 3974f2e..39bc9ff 100644
--- a/drivers/coresight/coresight.c
+++ b/drivers/coresight/coresight.c
@@ -1,4 +1,4 @@
-/* Copyright (c) 2012, The Linux Foundation. All rights reserved.
+/* Copyright (c) 2012-2013, The Linux Foundation. All rights reserved.
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License version 2 and
@@ -566,6 +566,9 @@
 	struct coresight_device *csdev;
 	struct coresight_connection *conns;
 
+	if (IS_ERR_OR_NULL(desc))
+		return ERR_PTR(-EINVAL);
+
 	csdev = kzalloc(sizeof(*csdev), GFP_KERNEL);
 	if (!csdev) {
 		ret = -ENOMEM;