summaryrefslogtreecommitdiff
path: root/drivers/staging/gasket/gasket_sysfs.c
diff options
context:
space:
mode:
authorTodd Poynor <toddpoynor@google.com>2018-07-17 13:56:48 -0700
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2018-07-19 11:39:47 +0200
commit03c25b3ad0405063f8e82871cfaef627dff4d26b (patch)
tree4c2773108c5bd3ef7b6ff98102d1b5b9ff38d632 /drivers/staging/gasket/gasket_sysfs.c
parentcf2865a0c70c645c50d2665ca66228872e225ed0 (diff)
staging: gasket: Remove stale pointers on error allocating attr array
If gasket_sysfs_create_mapping() hits errors allocating the attribute array, remove stale pointers to device info from the mapping object. Signed-off-by: Zhongze Hu <frankhu@chromium.org> Signed-off-by: Todd Poynor <toddpoynor@google.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/staging/gasket/gasket_sysfs.c')
-rw-r--r--drivers/staging/gasket/gasket_sysfs.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/drivers/staging/gasket/gasket_sysfs.c b/drivers/staging/gasket/gasket_sysfs.c
index dd4d3aaa57e2..1c5f7502e0d5 100644
--- a/drivers/staging/gasket/gasket_sysfs.c
+++ b/drivers/staging/gasket/gasket_sysfs.c
@@ -225,6 +225,8 @@ int gasket_sysfs_create_mapping(
mapping->attribute_count = 0;
if (!mapping->attributes) {
gasket_nodev_error("Unable to allocate sysfs attribute array.");
+ mapping->device = NULL;
+ mapping->gasket_dev = NULL;
mutex_unlock(&mapping->mutex);
mutex_unlock(&function_mutex);
return -ENOMEM;