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>
This commit is contained in:
Pratik Patel 2012-12-02 20:33:50 -08:00 committed by Iliyan Malchev
parent f55d6eee8a
commit 46fe66a7c8

View file

@ -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 *coresight_register(struct coresight_desc *desc)
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;