[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20180714055816.223754-6-toddpoynor@gmail.com>
Date: Fri, 13 Jul 2018 22:58:03 -0700
From: Todd Poynor <toddpoynor@...il.com>
To: Rob Springer <rspringer@...gle.com>,
John Joseph <jnjoseph@...gle.com>,
Ben Chan <benchan@...omium.org>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>
Cc: Zhongze Hu <frankhu@...omium.org>, Simon Que <sque@...omium.org>,
Dmitry Torokhov <dtor@...omium.org>,
Guenter Roeck <groeck@...omium.org>,
devel@...verdev.osuosl.org, linux-kernel@...r.kernel.org,
Todd Poynor <toddpoynor@...gle.com>
Subject: [PATCH 05/18] staging: gasket: sysfs mapping creation fixups
From: Todd Poynor <toddpoynor@...gle.com>
Return EBUSY for attempt to create a mapping already in use.
Remove stale pointers on error allocating attr array.
Signed-off-by: Zhongze Hu <frankhu@...omium.org>
Signed-off-by: Todd Poynor <toddpoynor@...gle.com>
---
drivers/staging/gasket/gasket_sysfs.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/staging/gasket/gasket_sysfs.c b/drivers/staging/gasket/gasket_sysfs.c
index a3705d6e088a..d1856a09b894 100644
--- a/drivers/staging/gasket/gasket_sysfs.c
+++ b/drivers/staging/gasket/gasket_sysfs.c
@@ -213,7 +213,7 @@ int gasket_sysfs_create_mapping(
"0x%p.", device);
put_mapping(mapping);
mutex_unlock(&function_mutex);
- return -EINVAL;
+ return -EBUSY;
}
/* Find the first empty entry in the array. */
@@ -244,6 +244,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;
--
2.18.0.203.gfac676dfb9-goog
Powered by blists - more mailing lists