From patchwork Fri Feb 2 15:39:24 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: SF Markus Elfring X-Patchwork-Id: 868642 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=linux-i2c-owner@vger.kernel.org; receiver=) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 3zY1Q45Y7lz9s7M for ; Sat, 3 Feb 2018 02:39:56 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751887AbeBBPjz (ORCPT ); Fri, 2 Feb 2018 10:39:55 -0500 Received: from mout.web.de ([212.227.15.14]:63765 "EHLO mout.web.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751674AbeBBPjm (ORCPT ); Fri, 2 Feb 2018 10:39:42 -0500 Received: from [192.168.1.2] ([92.228.169.238]) by smtp.web.de (mrweb004 [213.165.67.108]) with ESMTPSA (Nemesis) id 0Lfmd0-1f6Iw23Dhq-00pMGH; Fri, 02 Feb 2018 16:39:24 +0100 Subject: [PATCH 1/2] i2c-nomadik: Delete an error message for a failed memory allocation in nmk_i2c_probe() From: SF Markus Elfring To: linux-i2c@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Linus Walleij , Wolfram Sang Cc: LKML , kernel-janitors@vger.kernel.org References: <97f41346-6abb-1c14-f536-ad12bbcb4c60@users.sourceforge.net> Message-ID: <9448237a-67cb-0e7c-0837-ad1b89fc41a1@users.sourceforge.net> Date: Fri, 2 Feb 2018 16:39:24 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.6.0 MIME-Version: 1.0 In-Reply-To: <97f41346-6abb-1c14-f536-ad12b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HAexcJAMZOF7bbXPF/naBe3jfjfa/Lfkc9aZjvEZz+6GqcqmZd0hzoLhUq0f9WnFzm uJUfyL+fzBJbwaDAwKmBRyoHqUnvNhn+2s081ZbRSa+dBnlzVA= Sender: linux-i2c-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-i2c@vger.kernel.org From: Markus Elfring Date: Fri, 2 Feb 2018 16:25:14 +0100 Omit an extra message for a memory allocation failure in this function. This issue was detected by using the Coccinelle software. Signed-off-by: Markus Elfring --- drivers/i2c/busses/i2c-nomadik.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/i2c/busses/i2c-nomadik.c b/drivers/i2c/busses/i2c-nomadik.c index 49c7c0c91486..a783ad25fe19 100644 --- a/drivers/i2c/busses/i2c-nomadik.c +++ b/drivers/i2c/busses/i2c-nomadik.c @@ -975,7 +975,6 @@ static int nmk_i2c_probe(struct amba_device *adev, const struct amba_id *id) dev = devm_kzalloc(&adev->dev, sizeof(struct nmk_i2c_dev), GFP_KERNEL); if (!dev) { - dev_err(&adev->dev, "cannot allocate memory\n"); ret = -ENOMEM; goto err_no_mem; } From patchwork Fri Feb 2 15:40:17 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: SF Markus Elfring X-Patchwork-Id: 868643 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=linux-i2c-owner@vger.kernel.org; receiver=) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 3zY1R23blsz9s7M for ; Sat, 3 Feb 2018 02:40:46 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751959AbeBBPkk (ORCPT ); Fri, 2 Feb 2018 10:40:40 -0500 Received: from mout.web.de ([212.227.15.4]:63454 "EHLO mout.web.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751569AbeBBPke (ORCPT ); Fri, 2 Feb 2018 10:40:34 -0500 Received: from [192.168.1.2] ([92.228.169.238]) by smtp.web.de (mrweb003 [213.165.67.108]) with ESMTPSA (Nemesis) id 0MejjU-1eNvmE2H8q-00OEV3; Fri, 02 Feb 2018 16:40:18 +0100 Subject: [PATCH 2/2] i2c-nomadik: Improve a size determination in nmk_i2c_probe() From: SF Markus Elfring To: linux-i2c@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Linus Walleij , Wolfram Sang Cc: LKML , kernel-janitors@vger.kernel.org References: <97f41346-6abb-1c14-f536-ad12bbcb4c60@users.sourceforge.net> Message-ID: Date: Fri, 2 Feb 2018 16:40:17 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.6.0 MIME-Version: 1.0 In-Reply-To: <97f41346-6abb-1c14-f536-ad12bbcb4c60@users.sourceforge.net> Content-Language: en-US X-Provags-ID: V03:K0:YyIlpzs0C6ZKp9YaS9+pr3tGNMOKDIhj50srxdbvfHZMgFHy9zz CKYEZ0UOk5FrAlqhV3AEYOmZG/pPUTVMVafAsAtTagiw9Dy8cUxfAqXxOLiRWzrA8OxjKsy bflRwRQIAOFSz//hVBGvXNDiDVTj2lshzMaFD8sgsc1XgMLcYolXdB5RRfEwzTDsZmvI7CW qWK67z9mxZoYUGbIsHFDA== X-UI-Out-Filterresults: notjunk:1; V01:K0:WFP1EF0tjgE=:WKJV5PdW3OAXTyRGiXIq+1 cbMoJrHZrk3JxByTbY8ohb8rD674oKTpphhMtpEQyHIvITKQJrRWhsEUMLA3O8oJDoAuSeux0 ToR6mT6xDPAtFZyzFO9faNulVulNLLK1Wrvc2GoeSMrhB8lGZ0CKWKdaHHrbzFxNCEQDHwAPb oqCWKEh5vExgx+CRN3tuB18WAvRZsiWQvgUEG15LRo8Uk2ujBZFtufM34HaA9/jodBJ/Pep7p gtxlsruB/N+nKdQK+qj25e5YMVZF3tT8DONzMAlpUXsw6LAAxOV7y9TMaZeDzPdbTUkQnnOKl NIRVmpZzCk+81nUBVQVWY2mbiF7yib4biEoLtGDc6DpWWDY3cSxfzgItbuEO+pvAcsxXG7qni bOjL7NipuGavN9dt2t/DRmt0L03JyToIJ1DSOHmzMY/VZqUqwwDOtBurGP/HSurSKElqJsaP9 DZpPIzZFDWhM/4KWMYWkKCZm0l+qhqddz3o8dueLmtd+EaIrkVPqXrk9xMrJGoYRCBlm+KBUA GyjLZktXqkk6lK5pY1rCOxHullS6qoKwE6HQ9R9kYluIE58BkhZMmcTlTzhnKFxR+IkHOF88D wEcF5AWWaQu7Xz2k10R7y2JeTwf6AbYw6zKag7dS+HI6J9WkdyqT7ihzd50+RuOa8s51r9mrH 11WozojIcl+cfrlSprIjPVrkyh2/pd88ywU3BAIMukzCshQYr4ItcjIvBD1RKxgEGUyqlnLZM fZ5aWKL1ECT+81t2ApYx04NuvVGIx31vvHq9/vR0S0EvO7oHWFRAHE1RTinGNbkpTavYjcPXK TWosvWdos6/AT3OhQyvIN+FRT+748BWd4WVJLpbWXyb7VxP2HA= Sender: linux-i2c-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-i2c@vger.kernel.org From: Markus Elfring Date: Fri, 2 Feb 2018 16:28:20 +0100 Replace the specification of a data structure by a pointer dereference as the parameter for the operator "sizeof" to make the corresponding size determination a bit safer according to the Linux coding style convention. This issue was detected by using the Coccinelle software. Signed-off-by: Markus Elfring --- drivers/i2c/busses/i2c-nomadik.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/i2c/busses/i2c-nomadik.c b/drivers/i2c/busses/i2c-nomadik.c index a783ad25fe19..e353b528140e 100644 --- a/drivers/i2c/busses/i2c-nomadik.c +++ b/drivers/i2c/busses/i2c-nomadik.c @@ -973,7 +973,7 @@ static int nmk_i2c_probe(struct amba_device *adev, const struct amba_id *id) struct i2c_vendor_data *vendor = id->data; u32 max_fifo_threshold = (vendor->fifodepth / 2) - 1; - dev = devm_kzalloc(&adev->dev, sizeof(struct nmk_i2c_dev), GFP_KERNEL); + dev = devm_kzalloc(&adev->dev, sizeof(*dev), GFP_KERNEL); if (!dev) { ret = -ENOMEM; goto err_no_mem;