Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge branch 'mailbox-devel' of git://git.linaro.org/landing-teams/working/fujitsu/integration

Pull mailbox fixes from Jussi Brar:
"Misc fixes:

mailbox-test driver:
- prevent memory leak and another cosmetic change

mailbox:
- change the returned error code

Xgene driver:
- return -ENOMEM instead of PTR_ERR for failed devm_kzalloc"

* 'mailbox-devel' of git://git.linaro.org/landing-teams/working/fujitsu/integration:
mailbox: Stop using ENOSYS for anything other than unimplemented syscalls
mailbox: mailbox-test: Prevent memory leak
mailbox: mailbox-test: Use more consistent format for calling copy_from_user()
mailbox: xgene-slimpro: Fix wrong test for devm_kzalloc

+13 -11
+9 -7
drivers/mailbox/mailbox-test.c
··· 46 46 size_t count, loff_t *ppos) 47 47 { 48 48 struct mbox_test_device *tdev = filp->private_data; 49 - int ret; 50 49 51 50 if (!tdev->tx_channel) { 52 51 dev_err(tdev->dev, "Channel cannot do Tx\n"); ··· 59 60 return -EINVAL; 60 61 } 61 62 62 - tdev->signal = kzalloc(MBOX_MAX_SIG_LEN, GFP_KERNEL); 63 - if (!tdev->signal) 64 - return -ENOMEM; 63 + /* Only allocate memory if we need to */ 64 + if (!tdev->signal) { 65 + tdev->signal = kzalloc(MBOX_MAX_SIG_LEN, GFP_KERNEL); 66 + if (!tdev->signal) 67 + return -ENOMEM; 68 + } 65 69 66 - ret = copy_from_user(tdev->signal, userbuf, count); 67 - if (ret) { 70 + if (copy_from_user(tdev->signal, userbuf, count)) { 68 71 kfree(tdev->signal); 72 + tdev->signal = NULL; 69 73 return -EFAULT; 70 74 } 71 75 72 - return ret < 0 ? ret : count; 76 + return count; 73 77 } 74 78 75 79 static const struct file_operations mbox_test_signal_ops = {
+2 -2
drivers/mailbox/mailbox-xgene-slimpro.c
··· 189 189 int i; 190 190 191 191 ctx = devm_kzalloc(&pdev->dev, sizeof(struct slimpro_mbox), GFP_KERNEL); 192 - if (IS_ERR(ctx)) 193 - return PTR_ERR(ctx); 192 + if (!ctx) 193 + return -ENOMEM; 194 194 195 195 platform_set_drvdata(pdev, ctx); 196 196
+2 -2
drivers/mailbox/mailbox.c
··· 375 375 376 376 if (!np) { 377 377 dev_err(cl->dev, "%s() currently only supports DT\n", __func__); 378 - return ERR_PTR(-ENOSYS); 378 + return ERR_PTR(-EINVAL); 379 379 } 380 380 381 381 if (!of_get_property(np, "mbox-names", NULL)) { 382 382 dev_err(cl->dev, 383 383 "%s() requires an \"mbox-names\" property\n", __func__); 384 - return ERR_PTR(-ENOSYS); 384 + return ERR_PTR(-EINVAL); 385 385 } 386 386 387 387 of_property_for_each_string(np, "mbox-names", prop, mbox_name) {