diff options
Diffstat (limited to 'drivers/mailbox/mailbox-test.c')
-rw-r--r-- | drivers/mailbox/mailbox-test.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/drivers/mailbox/mailbox-test.c b/drivers/mailbox/mailbox-test.c index 5f4b439fd45a..58d04726cdd7 100644 --- a/drivers/mailbox/mailbox-test.c +++ b/drivers/mailbox/mailbox-test.c | |||
@@ -59,9 +59,12 @@ static ssize_t mbox_test_signal_write(struct file *filp, | |||
59 | return -EINVAL; | 59 | return -EINVAL; |
60 | } | 60 | } |
61 | 61 | ||
62 | tdev->signal = kzalloc(MBOX_MAX_SIG_LEN, GFP_KERNEL); | 62 | /* Only allocate memory if we need to */ |
63 | if (!tdev->signal) | 63 | if (!tdev->signal) { |
64 | return -ENOMEM; | 64 | tdev->signal = kzalloc(MBOX_MAX_SIG_LEN, GFP_KERNEL); |
65 | if (!tdev->signal) | ||
66 | return -ENOMEM; | ||
67 | } | ||
65 | 68 | ||
66 | if (copy_from_user(tdev->signal, userbuf, count)) { | 69 | if (copy_from_user(tdev->signal, userbuf, count)) { |
67 | kfree(tdev->signal); | 70 | kfree(tdev->signal); |