[PATCH 1/3] [media] Siano: Delete an error message for a failed memory allocation in three functions

From: SF Markus Elfring
Date: Mon Aug 28 2017 - 07:14:53 EST


From: Markus Elfring <elfring@xxxxxxxxxxxxxxxxxxxxx>
Date: Mon, 28 Aug 2017 12:30:11 +0200

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/media/common/siano/smscoreapi.c | 13 ++++---------
1 file changed, 4 insertions(+), 9 deletions(-)

diff --git a/drivers/media/common/siano/smscoreapi.c b/drivers/media/common/siano/smscoreapi.c
index e7a0d7798d5b..889b486fbc72 100644
--- a/drivers/media/common/siano/smscoreapi.c
+++ b/drivers/media/common/siano/smscoreapi.c
@@ -1304,7 +1304,5 @@ static int smscore_init_device(struct smscore_device_t *coredev, int mode)
- if (!buffer) {
- pr_err("Could not allocate buffer for init device message.\n");
+ if (!buffer)
return -ENOMEM;
- }

msg = (struct sms_msg_data *)SMS_ALIGN_ADDRESS(buffer);
SMS_INIT_MSG(&msg->x_msg_header, MSG_SMS_INIT_DEVICE_REQ,
@@ -1690,7 +1688,6 @@ static int smscore_validate_client(struct smscore_device_t *coredev,
- if (!listentry) {
- pr_err("Can't allocate memory for client id.\n");
+ if (!listentry)
return -ENOMEM;
- }
+
listentry->id = id;
listentry->data_type = data_type;
list_add_locked(&listentry->entry, &client->idlist,
@@ -1728,7 +1725,5 @@ int smscore_register_client(struct smscore_device_t *coredev,
- if (!newclient) {
- pr_err("Failed to allocate memory for client.\n");
+ if (!newclient)
return -ENOMEM;
- }

INIT_LIST_HEAD(&newclient->idlist);
newclient->coredev = coredev;
--
2.14.1