From patchwork Sun Jan 22 08:32:19 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: 9530833 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 627CB6020B for ; Sun, 22 Jan 2017 08:32:24 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 56A9727DA4 for ; Sun, 22 Jan 2017 08:32:24 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4BAD028306; Sun, 22 Jan 2017 08:32:24 +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 E622527DA4 for ; Sun, 22 Jan 2017 08:32:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751436AbdAVIcX (ORCPT ); Sun, 22 Jan 2017 03:32:23 -0500 Received: from mout.web.de ([212.227.15.4]:55142 "EHLO mout.web.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751217AbdAVIcW (ORCPT ); Sun, 22 Jan 2017 03:32:22 -0500 Received: from [192.168.1.2] ([78.48.136.24]) by smtp.web.de (mrweb004 [213.165.67.108]) with ESMTPSA (Nemesis) id 0LlayN-1bvsUG3Xbb-00bH0y; Sun, 22 Jan 2017 09:32:19 +0100 Subject: [PATCH 2/5] blk-throttle: Move an assignment for the variable "ret" in tg_set_conf() To: linux-block@vger.kernel.org, Jens Axboe References: Cc: LKML , kernel-janitors@vger.kernel.org From: SF Markus Elfring Message-ID: Date: Sun, 22 Jan 2017 09:32:19 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.6.0 MIME-Version: 1.0 In-Reply-To: X-Provags-ID: V03:K0:+Ekn9Miuh2AeP8Re0sU2dGFrumRJ0eXC6w0g6s4QkiWrDgoemgP YGdpJoTMjScagz0ZVM5/2mgF24pgJBPmLYskP3d0iZ0vW1lLlcL6dGVfzJlnNZj+T2eVOEi afbWfYd2YqnFUeSWGxQDgzsW6oSM8zCQkFB0uX6Wsrnn0g/gP1OqjqLdMVcPLR5eUu4XyVU NerCJQGkxin/YmlVS22LQ== X-UI-Out-Filterresults: notjunk:1; V01:K0:PZv9WIBJp68=:315JqGr86mWINWGz+RGUMc R4YSjO+BYyiN678kc8FjeDJomYfJu8BHsng415QlqSJYTpKocdQoXaOTJbi2vzNbsTceT4ArR 1OcxDy95Bnk70u6LCq8Plxf3D4XlMk4x+ZGqMJ+n+2iIeMq8z0NLco/P0fiEczszyRHpcIbIt Qx0Tne+ZLeMWLJgWOJunjmvY6WGcKbgDSkYcE7keFgW1E0HuLRao/6HJQ+TZPA9byAOJ88pxW 0wKxwIFscRpUvP7L/qRAeeoagDT2MwpzN/BH9lrc3BeOn6E3GSycUhk16ELUf0YYO1ck/jtQW nZUPM9vBHBTUbOXtJYccvnc6lUiuhMhTskk3aC0aRtjs0Bd72eQojRheXWnZsaHDRDmFNINKz ehiXLiiYerbHbihyR8SY70WJ7jHRsOWMzywtePNMxOlVcqC0HaIy/nhEzvqj0zyfuDmmAhuQi an632QPdN1cSaxUXutlRSO3Bj5YaYVuLM68/u45fs+X91hW05Este3grc+Bf+XkUcSrIcU163 f1RlUiC6UzhM+syl5L0JGJxr6jE/xDIznykhojHdS8E+JDCcfZrQ4zexhZzVR9Ohgn39Rj3gm d3miuuD7T4TUWZyKE7/8rhn/I6545hgDLOfax1uCRSLpU8ArYIf8QAsJBwrG4ApsoijWkZVwm okwT5lZ84Tys26C+NCyP8siABLsJg6HspNm0pxL6/YA1oQnDFEZcVC3v5mu9J+u+GlOikvAOA vZfwkEK2yG/z+KpusC3wCOn39zWiDwBRZEmgKB5kX1q935lkH+obZlUbQZXIz5EcxaC5ZSFfi 4cXvMjh Sender: linux-block-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Markus Elfring Date: Sat, 21 Jan 2017 21:40:38 +0100 A local variable was set to an error code before a concrete error situation was detected. Thus move the corresponding assignment into an if branch to indicate a software failure there. This issue was detected by using the Coccinelle software. Signed-off-by: Markus Elfring --- block/blk-throttle.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/block/blk-throttle.c b/block/blk-throttle.c index 51d112deb02e..b392b48310ba 100644 --- a/block/blk-throttle.c +++ b/block/blk-throttle.c @@ -1191,9 +1191,10 @@ static ssize_t tg_set_conf(struct kernfs_open_file *of, if (ret) return ret; - ret = -EINVAL; - if (sscanf(ctx.body, "%llu", &v) != 1) + if (sscanf(ctx.body, "%llu", &v) != 1) { + ret = -EINVAL; goto out_finish; + } if (!v) v = -1;