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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

--
To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Kernel Development]     [Kernel Announce]     [Kernel Newbies]     [Linux Networking Development]     [Share Photos]     [IDE]     [Security]     [Git]     [Netfilter]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Device Mapper]

  Powered by Linux