[PATCH 1/5] misc/pti: Delete an error message for a failed memory allocation in two functions

From: SF Markus Elfring
Date: Tue Jan 09 2018 - 13:28:44 EST


From: Markus Elfring <elfring@xxxxxxxxxxxxxxxxxxxxx>
Date: Tue, 9 Jan 2018 18:00:15 +0100

Omit an extra message for a memory allocation failure in these functions.

This issue was detected by using the Coccinelle software.

Signed-off-by: Markus Elfring <elfring@xxxxxxxxxxxxxxxxxxxxx>
---
drivers/misc/pti.c | 8 +-------
1 file changed, 1 insertion(+), 7 deletions(-)

diff --git a/drivers/misc/pti.c b/drivers/misc/pti.c
index 41f2a9f6851d..92a1a20839c8 100644
--- a/drivers/misc/pti.c
+++ b/drivers/misc/pti.c
@@ -619,11 +619,8 @@ static ssize_t pti_char_write(struct file *filp, const char __user *data,
mc = filp->private_data;

kbuf = kmalloc(size, GFP_KERNEL);
- if (kbuf == NULL) {
- pr_err("%s(%d): buf allocation failed\n",
- __func__, __LINE__);
+ if (!kbuf)
return -ENOMEM;
- }

do {
if (len - n > USER_COPY_SIZE)
@@ -826,9 +823,6 @@ static int pti_pci_probe(struct pci_dev *pdev,
drv_data = kzalloc(sizeof(*drv_data), GFP_KERNEL);
if (drv_data == NULL) {
retval = -ENOMEM;
- dev_err(&pdev->dev,
- "%s(%d): kmalloc() returned NULL memory.\n",
- __func__, __LINE__);
goto err_disable_pci;
}
drv_data->pti_addr = pci_resource_start(pdev, pci_bar);
--
2.15.1