From patchwork Mon Aug 28 11:14:30 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: SF Markus Elfring X-Patchwork-Id: 9925315 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id F30F460311 for ; Mon, 28 Aug 2017 11:15:02 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E7CF3286B8 for ; Mon, 28 Aug 2017 11:15:02 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id DC10C286BF; Mon, 28 Aug 2017 11:15:02 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9AB31286B8 for ; Mon, 28 Aug 2017 11:15:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751374AbdH1LOt (ORCPT ); Mon, 28 Aug 2017 07:14:49 -0400 Received: from mout.web.de ([217.72.192.78]:54028 "EHLO mout.web.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751194AbdH1LOs (ORCPT ); Mon, 28 Aug 2017 07:14:48 -0400 Received: from [192.168.1.2] ([78.48.87.233]) by smtp.web.de (mrweb102 [213.165.67.124]) with ESMTPSA (Nemesis) id 0MaJro-1e60jw1KGW-00JvuH; Mon, 28 Aug 2017 13:14:32 +0200 Subject: [PATCH 1/3] [media] Siano: Delete an error message for a failed memory allocation in three functions From: SF Markus Elfring To: linux-media@vger.kernel.org, Mauro Carvalho Chehab , Sakari Ailus Cc: LKML , kernel-janitors@vger.kernel.org References: <386b5a60-548e-1896-5271-4875fa2aea94@users.sourceforge.net> Message-ID: <11f54f52-6ba0-3432-0544-b71cd3d36b74@users.sourceforge.net> Date: Mon, 28 Aug 2017 13:14:30 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.3.0 MIME-Version: 1.0 In-Reply-To: <386b5a60-548e-1896-5271-4875fa2aea94@users.sourceforge.net> Content-Language: en-GB X-Provags-ID: V03:K0:2tVyEjjwW5sHrLMkJtIK4g+D1GUkPkkwLFM2B5ff01eXKGiDH+2 yfAaJerS8zP0+kcOuxSy8xRcejZ/cwFKBmIKXrK1XcRgVh4UolyXGsshT/vN9e8D8Zu+gyZ S3WuBBNXYJTw/r81qJKE8gfkkROiItVc6Xq8GQ0ITzXdD8bd6jw3YRYp+F5HJjCHOaKLzSY hZeoxZ3cR7xmQnXn6A2RQ== X-UI-Out-Filterresults: notjunk:1; V01:K0:a4945VzYHyE=:uic2G0FfgjBr4VHKddovRB przeXrOkNbGojgPA9ggarZghXJXjAOPe81otmzoy3DaJtQ79K/EH070MkauOQhoiLoJExFGTl AJT6NhGKdktshY9Z5B+lV8VfHZzSnB0FCUYpV2XfSTiF1TiBqjEnmb6zTaObt1HTQeT9x9CYe dwL9G6Rmuj/WcPLevz3yZ6TjOfLUIEICo6jCZikEgZHSnxogiAqeiy/zQTghq1KO07Hl0bePJ cFK+dRqlYhivk6U9dYxRGPKPwlox8KgJ4koLUUs1/KQtk2xDRf75ZkyRAH7GrhpDRrAf5crKi aIB6LaYhjmWWkjqwZtUeRSpJuHL+FYzxKk4gWFsURiT1snKEgPwEpIhpoQ+Z9Coz5VALqfBnM fITi5VnW8Wa/yKBriHk1gGd7ZPLcIPYYViI/S2JsePjZsj/q4a5HoKCamW89mMssUuLXoZr09 7bWZJe+VO/zaMuRh7ifAEzGPMmDynfBpNrtkuoZGGIgsZTlsnoFI18bKdfaGLqRIqdp5+rAhl 4O3t4EzHvyVxCcHoaQyvVCpWFj496JW5w/QdGyCTLL4HRAqVX/nP0b4MFZRRVSx6WckG7PQCm iTLo8/2YjHjBeKS/KZY0qp+YmDI5AyoW4Md5P1XhpOtnAli8jEtdLdwnW+PB4j0Pr07pbsTZS 0r7YcoHwWvyFMtR2H3sx0FsJuHk2+xFqTDn6ocC0ldeG6uYU6ZFfhyxXG/6C3wEvKHVUVvYN8 /a0fRi17J9qVLxzPJKHNXvWniy/hqLPrUCYU00Mcwe1hqreZTMg4DuSBCT/aLiXpyuB7nRFRE XnekH4IHWwl7jA2Hfh8yYortclCf4HzZfK0N1DaVbzBwj/rrWI= Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Markus Elfring 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 --- 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;