From patchwork Sun Sep 17 08:20:01 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: 9954665 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 DC80C601D5 for ; Sun, 17 Sep 2017 08:20:41 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C080F2894E for ; Sun, 17 Sep 2017 08:20:41 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B1BA828A7D; Sun, 17 Sep 2017 08:20:41 +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=ham 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 338F728ADB for ; Sun, 17 Sep 2017 08:20:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751239AbdIQIUP (ORCPT ); Sun, 17 Sep 2017 04:20:15 -0400 Received: from mout.web.de ([212.227.17.12]:56823 "EHLO mout.web.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750802AbdIQIUO (ORCPT ); Sun, 17 Sep 2017 04:20:14 -0400 Received: from [192.168.1.2] ([77.181.201.34]) by smtp.web.de (mrweb102 [213.165.67.124]) with ESMTPSA (Nemesis) id 0LkPnr-1dHyOn1OsV-00cQZE; Sun, 17 Sep 2017 10:20:02 +0200 Subject: [PATCH 1/2] [media] tda18212: Delete an error message for a failed memory allocation in tda18212_probe() From: SF Markus Elfring To: linux-media@vger.kernel.org, Antti Palosaari , Mauro Carvalho Chehab Cc: LKML , kernel-janitors@vger.kernel.org References: Message-ID: <118a0240-23a9-d688-54c2-fc4113a195c4@users.sourceforge.net> Date: Sun, 17 Sep 2017 10:20:01 +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: Content-Language: en-GB X-Provags-ID: V03:K0:SI0IwuahMqzpFIsVgtafwQGVAX/BfAILslLfRdUatlQcSsWVDA1 ThVKp8xUdzr2YBanX//0qDMVxzyawb7MM8JgOe27Duma2YrbcO31sbyVbVQbOxGHP3283Vo T9Sbn3cs9nYI8E7xZzPfFDbPahj5jTD1hHWddn+qBYmMieK862stRdM1cNGBVYUtKjz1p0g gz7G7eOM9dpqsWOd7BLXA== X-UI-Out-Filterresults: notjunk:1; V01:K0:lf6TWN04QO0=:M912iKHcipn+sKPhcyoIo9 r+xw1q6QnJk5Vkd5Zj3N+ox31okHdfgL/LL5TsubklNP4nGBA6AU5gQNE8foBS/X1nHw62BQb PhH31jxq9MH3DKA8QjDFocPcOHA4Blo+/BoIEkRlTs6aKX7qOsNCuUvrZ6P7/1QCTZxbN8ILE uffeMVM59dQ3hneEPAN+W7bIRI5iTzhSoRV8jTo3eAMFQhRa9sp3HetVWB27SLRssUTAM2+jh qvUFbeaFQ0URAPIDkWA8dGily+6jf+Qy6dyKFQMEw+nRC9xloA6TDf2sMHB7VOk5/N8NPwRxS EzXN3XT9HIYOQnYAQK3JoiYYdQRx6oLC6r8PNG3JOBwWOPuLTIckqDRNCwjwXiw/L23H9kKnK 9GikqIH2WjrEZ7hE53AxEuFu9ucVqcm9OF7M2RCnXvpgLLZE5+VSlzyoa0uGDwFXk1Q7+cDws 858hvjaoNJGuLkYGzrTbm6vK7iommSyWTNKdzeyyMKF7WSypqIIbxu/w05alXINe67mzAjK4B 9Uw/Krvf08dgEzwVsyFZmFwAH6RQZ7Cjxeb18eY242PcuHAqPzioKOfUelNo6UF6m7oC0MFlm LV3RWapp56QZRn2ie9fko8hUSH4ma7/gYs5cHTKLBkCV75cJWRYE8aPZZ+LP6veKQ7D5pi7cG KbBGMcpjNDtHiQ34nXW5eLkwY6/rv7fOB/qRVfDA6qUkzK3vXayjQeBeGmmOeEH9FYLy59ScY lakvhMlhVBZrKqOt7+Ri7SoLKn168hT0qtFuK7NgicgY/q0ZtjukwLq2bSvKJ2M3EgnKj2WS9 jR0h/rjiEksWPs76wT2Mqp2vp+bOFjmEVBagOUcXTkxjwePzSM= 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: Sun, 17 Sep 2017 09:33:58 +0200 * Omit an extra message for a memory allocation failure in this function. This issue was detected by using the Coccinelle software. * Add a jump target so that the function "kfree" will be always called with a non-null pointer. Signed-off-by: Markus Elfring --- drivers/media/tuners/tda18212.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/media/tuners/tda18212.c b/drivers/media/tuners/tda18212.c index 7b8068354fea..8f89d52cd39c 100644 --- a/drivers/media/tuners/tda18212.c +++ b/drivers/media/tuners/tda18212.c @@ -204,6 +204,5 @@ static int tda18212_probe(struct i2c_client *client, if (dev == NULL) { ret = -ENOMEM; - dev_err(&client->dev, "kzalloc() failed\n"); - goto err; + goto report_failure; } @@ -250,8 +249,9 @@ static int tda18212_probe(struct i2c_client *client, return 0; err: - dev_dbg(&client->dev, "failed=%d\n", ret); kfree(dev); +report_failure: + dev_dbg(&client->dev, "failed=%d\n", ret); return ret; }