Client code wishing to make use of nvec_write_sync() must have a way to free the returned pointer, otherwise we run out of poool memory fairly soon. Signed-off-by: Julian Andres Klode <jak@xxxxxxxxxxxxx> --- drivers/staging/nvec/nvec.c | 6 ++++-- drivers/staging/nvec/nvec.h | 3 +++ 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/drivers/staging/nvec/nvec.c b/drivers/staging/nvec/nvec.c index dc79b43..46cd1ad 100644 --- a/drivers/staging/nvec/nvec.c +++ b/drivers/staging/nvec/nvec.c @@ -157,11 +157,12 @@ static struct nvec_msg *nvec_msg_alloc(struct nvec_chip *nvec) * * Free the given message */ -static void nvec_msg_free(struct nvec_chip *nvec, struct nvec_msg *msg) +inline void nvec_msg_free(struct nvec_chip *nvec, struct nvec_msg *msg) { dev_vdbg(nvec->dev, "INFO: Free %i\n", (int) (msg - nvec->msg_pool)); atomic_set(&msg->used, 0); } +EXPORT_SYMBOL_GPL(nvec_msg_free); /** * nvec_msg_is_event - Return %true if @msg is an event @@ -256,7 +257,8 @@ EXPORT_SYMBOL(nvec_write_async); * interrupt handlers. * * Returns: A pointer to the response message on success, - * %NULL on failure. + * %NULL on failure. Free with nvec_msg_free() once no longer + * used. */ struct nvec_msg *nvec_write_sync(struct nvec_chip *nvec, const unsigned char *data, short size) diff --git a/drivers/staging/nvec/nvec.h b/drivers/staging/nvec/nvec.h index f4ff034..f128779 100644 --- a/drivers/staging/nvec/nvec.h +++ b/drivers/staging/nvec/nvec.h @@ -189,4 +189,7 @@ extern int nvec_register_notifier(struct nvec_chip *nvec, extern int nvec_unregister_notifier(struct device *dev, struct notifier_block *nb, unsigned int events); + +extern void nvec_msg_free(struct nvec_chip *nvec, struct nvec_msg *msg); + #endif -- 1.7.5.4 _______________________________________________ devel mailing list devel@xxxxxxxxxxxxxxxxxxxxxx http://driverdev.linuxdriverproject.org/mailman/listinfo/devel