summaryrefslogtreecommitdiff
path: root/drivers/mailbox/mailbox-test.c
AgeCommit message (Collapse)Author
2016-06-12mailbox: mailbox-test: set tdev->signal to NULL after freeingSudeep Holla
tdev->signal is not set NULL after it's freed. This will cause random exceptions when the stale pointer is accessed after tdev->signal is freed. Also, since tdev->signal allocation is skipped the next time it's written, this leads to continuous fault finally leading to the total death of the system. Fixes: d1c2f87c9a8f ("mailbox: mailbox-test: Prevent memory leak") Signed-off-by: Sudeep Holla <sudeep.holla@arm.com> Acked-by: Lee Jones <lee.jones@linaro.org> Signed-off-by: Jassi Brar <jaswinder.singh@linaro.org>
2016-04-12mailbox: mailbox-test: Prevent memory leakLee Jones
If we set the Signal twice or more, without using it as part of a message, memory will be re-allocated and the pointer over-written. Prevent this potential leak by only allocating memory when there isn't any already. Reported-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Lee Jones <lee.jones@linaro.org> Signed-off-by: Jassi Brar <jaswinder.singh@linaro.org>
2016-04-12mailbox: mailbox-test: Use more consistent format for calling copy_from_user()Lee Jones
While we're at it, ensure copy-to location is NULL'ed in the error path. Suggested-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Lee Jones <lee.jones@linaro.org> Signed-off-by: Jassi Brar <jaswinder.singh@linaro.org>
2016-03-04mailbox: mailbox-test: add support for separate tx/rx buffer with single channelSudeep Holla
This patch adds support for different MMIO region for Tx and Rx paths. If only one region is specified, it's assumed to be shared between Rx and Tx, thereby retaining backward compatibility. Also in order to support single channel dealing with both Tx and Rx with dedicated MMIO regions, Tx channel itself is assigned to Rx if MMIO regions are different and Rx is not specified. Acked-by: Lee Jones <lee.jones@linaro.org> Signed-off-by: Sudeep Holla <sudeep.holla@arm.com> Signed-off-by: Jassi Brar <jaswinder.singh@linaro.org>
2016-03-04mailbox: mailbox-test: use print_hex_dump_bytes to allow dynamic printkSudeep Holla
Reduce the logging from info to debug. Also use print_hex_dump_bytes instead as it has support for dynamic printk providing options to conditionally enable/disable these logs. Cc: Lee Jones <lee.jones@linaro.org> Signed-off-by: Sudeep Holla <sudeep.holla@arm.com> Signed-off-by: Jassi Brar <jaswinder.singh@linaro.org>
2016-03-04mailbox: mailbox-test: fix the compatible stringSudeep Holla
Underscores are usually forbidden in the compatible strings. So lets remove it before the first users of this is seen. Acked-by: Rob Herring <robh@kernel.org> Acked-by: Lee Jones <lee.jones@linaro.org> Signed-off-by: Sudeep Holla <sudeep.holla@arm.com> Signed-off-by: Jassi Brar <jaswinder.singh@linaro.org>
2016-03-04mailbox: mailbox-test: rename driver as generic test driverSudeep Holla
This mailbox-test driver was designed to be generic, so let's remove ST tag on it and make it generic. Acked-by: Lee Jones <lee.jones@linaro.org> Signed-off-by: Sudeep Holla <sudeep.holla@arm.com> Signed-off-by: Jassi Brar <jaswinder.singh@linaro.org>
2015-11-04mailbox: mailbox-test: avoid reading iomem twiceJassi Brar
Don't pass mmio region as source to print_hex_dump() and then again to memcpy_fromio(). Do it once and give print_hex_dump() the buffer we just read the data in. Acked-by: Lee Jones <lee.jones@linaro.org> Signed-off-by: Jassi Brar <jaswinder.singh@linaro.org>
2015-10-27mailbox: Off by one in mbox_test_message_read()Dan Carpenter
We need to leave space for the NUL char. Fixes: 8ea4484d0c2b ('mailbox: Add generic mechanism for testing Mailbox Controllers') Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
2015-10-23mailbox: mailbox-test: Correctly repair Sparse warningsLee Jones
Kbuild test robot reported some Sparse warnings to the tune of: sparse: incorrect type in argument 6 (different address spaces) expected void const *buf got void [noderef] <asn:2>*mmio This was due to passing variables tagged with the Sparse cookie '__iomem' through into memcpy() and print_hex_dump() without adequate protection or casting. These issues were fixed in a previous patch suppressing the warnings, but the issue is indeed still present. This patch fixes the warnings in the correct way, i.e. by using the purposely authored memcpy_{from,to}io() derivatives in the memcpy() case and casting the memory address to (void *) and forcing Sparse to ignore to ignore it in the print_hex_dump() case [NB: This is also what the memcpy() derivatives do]. Reported-by: Peter Griffin <peter.griffin@linaro.org> Signed-off-by: Lee Jones <lee.jones@linaro.org> Signed-off-by: Jassi Brar <jaswinder.singh@linaro.org>
2015-10-17mailbox: Fix a couple of trivial static checker issuesLee Jones
This patch deals with a few spelling, white space and type warnings reported by Intel's Kbuild Test Robot. Reported-by: kbuild test robot <lkp@intel.com> Signed-off-by: Lee Jones <lee.jones@linaro.org> Signed-off-by: Jassi Brar <jaswinder.singh@linaro.org>
2015-10-17mailbox: Add generic mechanism for testing Mailbox ControllersLee Jones
This particular Client implementation uses shared memory in order to pass messages between Mailbox users; however, it can be easily hacked to support any type of Controller. Signed-off-by: Lee Jones <lee.jones@linaro.org> Signed-off-by: Jassi Brar <jaswinder.singh@linaro.org>