From patchwork Fri Feb 2 18:12:27 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: 868737 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 3zY4q63w4dz9t20 for ; Sat, 3 Feb 2018 05:13:22 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753510AbeBBSNH (ORCPT ); Fri, 2 Feb 2018 13:13:07 -0500 Received: from mout.web.de ([212.227.15.14]:61681 "EHLO mout.web.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753213AbeBBSMa (ORCPT ); Fri, 2 Feb 2018 13:12:30 -0500 Received: from [192.168.1.2] ([92.228.169.238]) by smtp.web.de (mrweb002 [213.165.67.108]) with ESMTPSA (Nemesis) id 0MLyCC-1eeO2K0CWi-007mLl; Fri, 02 Feb 2018 19:12:28 +0100 Subject: [PATCH 1/2] i2c-bfin-twi: Delete an error message for a failed memory allocation in i2c_bfin_twi_probe() From: SF Markus Elfring To: linux-i2c@vger.kernel.org, Wolfram Sang Cc: LKML , kernel-janitors@vger.kernel.org References: <740e31b4-79dd-a4bf-a2f5-001c44864b79@users.sourceforge.net> Message-ID: Date: Fri, 2 Feb 2018 19:12:27 +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: <740e31b4-79dd-a4bf-a2f5-001c44864b79@users.sourceforge.net> Content-Language: en-US X-Provags-ID: V03:K0:HdPZNF5tNswzvng+X3ZyQJxozf00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mod0arW6a2QzNuut0tVN1s= 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 18:55:04 +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-bfin-twi.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/i2c/busses/i2c-bfin-twi.c b/drivers/i2c/busses/i2c-bfin-twi.c index ff3343186a82..ed596fd56b8b 100644 --- a/drivers/i2c/busses/i2c-bfin-twi.c +++ b/drivers/i2c/busses/i2c-bfin-twi.c @@ -621,10 +621,8 @@ static int i2c_bfin_twi_probe(struct platform_device *pdev) iface = devm_kzalloc(&pdev->dev, sizeof(struct bfin_twi_iface), GFP_KERNEL); - if (!iface) { - dev_err(&pdev->dev, "Cannot allocate memory\n"); + if (!iface) return -ENOMEM; - } spin_lock_init(&(iface->lock)); From patchwork Fri Feb 2 18:13:19 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: 868738 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 3zY4qF4lMzz9sR8 for ; Sat, 3 Feb 2018 05:13:29 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754080AbeBBSN1 (ORCPT ); Fri, 2 Feb 2018 13:13:27 -0500 Received: from mout.web.de ([212.227.15.4]:52066 "EHLO mout.web.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753924AbeBBSNW (ORCPT ); Fri, 2 Feb 2018 13:13:22 -0500 Received: from [192.168.1.2] ([92.228.169.238]) by smtp.web.de (mrweb001 [213.165.67.108]) with ESMTPSA (Nemesis) id 0LdVdS-1f8Rso05pq-00ihmB; Fri, 02 Feb 2018 19:13:20 +0100 Subject: [PATCH 2/2] i2c-bfin-twi: Improve a size determination in i2c_bfin_twi_probe() From: SF Markus Elfring To: linux-i2c@vger.kernel.org, Wolfram Sang Cc: LKML , kernel-janitors@vger.kernel.org References: <740e31b4-79dd-a4bf-a2f5-001c44864b79@users.sourceforge.net> Message-ID: <3a856fe7-5217-adcb-1da9-192a578b0422@users.sourceforge.net> Date: Fri, 2 Feb 2018 19:13:19 +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: <740e31b4-79dd-a4bf-a2f5-001c44864b79@users.sourceforge.net> Content-Language: en-US X-Provags-ID: V03:K0:A9x5WXjtAFktOdvatmvV9aae4Koopm1jcCHiHou+PghlTh+rHRl VC0/PtOCP1ld64Z3BFv2SIEB02JcjEBoF9uRnQTAvos77shQRHlwaTLnddj0dEBww+2xhuX mmozjy3a9cpfg7/HqluI3PEfP5/HNnK3u43Kkfjhhp8r8cg4TWLkYbXkcSoHs6+qUSU5/3v +5JiBS6YuBO6Nxqp0vnXw== X-UI-Out-Filterresults: notjunk:1; V01:K0:y2FUkeYUUms=:s+QwgsRJEhAqrnrTTXUHdW /txlYeigOv7Zn8KnoZ+DS+nZ1KR5+cx0nhOjo6NwSh+NSQu0PcvPF7K0Qj35Z5h/lahR8wBME 3ABC4AWKCpToeQ26aVu2PhqUg8cMRi0LCNEX5hNaq+v66JWOhdon4x3rwLo0QpEe1EtmD1kdl Z6iZXUENk2EogVtkZ5wgDVOPkGa34/TOgsPKmnfWCt+RnN6tdKi+QxeryJa/ZMrY7mH3Xdx8N 5PRet1+sij3wy1EKQJcaNlcdemen8SjnBFYnQl+rsPPrQ35f+NqPgn/ogv875xfacmhzUASNq CoCLx5F+DMpiRFG61EJ78xu9n+H41kgxClhVXq1jXLBoZE3FhFUblX9xT3KKrGmfTGVTWzGFS c5exeyRLOvnHWA6S5GkiZ6YZuK7gK3kMddmH8OOXX3qVQVyoDJc01TIf9ikQP16KSHbtwjo8N GGarJkY81Zc5dTsXg0SEZgxXrMd++a9wTHHHEEvzjzUoxhwdaHefQdGSTKyGmGHq3QcR6ciJI 52P6QcHSeresos1E6S2FZ3jx5wO+WZjVl+9ooxWQ9QiPkYFWmEjDaQKEFEKBSn7aU1QTW3YoH GYzhKCpGgjPobzxREZPQT1ooxrUv76DfTDlJdcafHMmM70DQTS6kKvr2oO6bWMOqIBoKYoU6u 62bJlr8iwhyG5lz6xGIhO/oEpq4EmKNURT934rtyMYXqCxatllbdf6g+FcbPX8g+HLlFoXIzb IbSYxmS7kZXB5mrHl2iUnG3XwuzXdgUBhbZdYjTyBdcVz1NcsbHMEvIEKrs/g8dwEk84WSaaW qZhfwvCJoak1SynTcqRrSvKajZSun4iv/6VmoUz2FXh7UshFDM= 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 19:01:14 +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-bfin-twi.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/i2c/busses/i2c-bfin-twi.c b/drivers/i2c/busses/i2c-bfin-twi.c index ed596fd56b8b..f57e3247f717 100644 --- a/drivers/i2c/busses/i2c-bfin-twi.c +++ b/drivers/i2c/busses/i2c-bfin-twi.c @@ -619,8 +619,7 @@ static int i2c_bfin_twi_probe(struct platform_device *pdev) int rc; unsigned int clkhilow; - iface = devm_kzalloc(&pdev->dev, sizeof(struct bfin_twi_iface), - GFP_KERNEL); + iface = devm_kzalloc(&pdev->dev, sizeof(*iface), GFP_KERNEL); if (!iface) return -ENOMEM;