From patchwork Mon Oct 29 16:23:19 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Lezcano X-Patchwork-Id: 149684 Delivered-To: patch@linaro.org Received: by 2002:a2e:299d:0:0:0:0:0 with SMTP id p29-v6csp4348605ljp; Mon, 29 Oct 2018 09:23:58 -0700 (PDT) X-Google-Smtp-Source: AJdET5f/XHpPb6XXdRF5+jsEP8S36qXvx3kL/mrn/tPK+YR7r4QZhcoiOX4Kowk0HmZxCrZLPe7n X-Received: by 2002:a62:5287:: with SMTP id g129-v6mr9330561pfb.17.1540830238606; Mon, 29 Oct 2018 09:23:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1540830238; cv=none; d=google.com; s=arc-20160816; b=egXygv+IZLbOLdfkczMAE3+POdiMtt855o1Hqm38ts25KA+KhGd0PRGyXoORxJxNLh NuwwB13fnxUFX0JAybKvYxU2c6+XBn9mwzSnFtFOqd+d8gKvlW+Uq2IgPD1cGYzO9MEK f3heTPfCU+j/SNo6EyZCkPXBAYP8L+oQwEdtVu0iXEIRmF4bIA1gLr+d7fkNFgxqIwv3 9HNAMHJSjzTAaAgVaJyKvdn7FRKewZVO1ZD/gSsPfimHHQb1/Scrx78VciwDFlGg07ZK ZeYa75Og+7A3LuVNWbTNOdASEm4kEqK2jcJ0agoG1yAhTV8v9ag8zxVez3TJFNVoFbCK Q2VA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature; bh=yJCtkrkfIFoRj9cRN8aqIPKmbD9Nc3jaK1cwdarWAHs=; b=Y9aOFIEt2CJm4msO22EBONHmiynZX8y9vz4zzGDflw6+7y2ora1qywStDBKHjNgfcD BSqvNU4DO9i9PwpAQiepZL8oCHDhS9LfN+2J4x2xuMefyH8fJarkIUUMRE9uwlb3bFxy NY3B3Xec4V2j7ML+NMN+9fgLVaArcBcjA5nM8tZJBoIu5Hzy6JgIhjjX9XXwfpw0IpR3 FzCsBLP/B+1iPqyls05zljy5INWT5lOQnNCXtXj0o6Q4bhPk+nSqBwS7Ba/cGVvrM6QI zEqiOC6TME4eXqBjywTCBkBSewtA/At9yRiOoFNiuSuKCYXEAwt9hZCDokZZ+iuHHKRd HxOg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=b9l2MmIp; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 63-v6si20701245pfg.178.2018.10.29.09.23.58; Mon, 29 Oct 2018 09:23:58 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=b9l2MmIp; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728115AbeJ3BNO (ORCPT + 32 others); Mon, 29 Oct 2018 21:13:14 -0400 Received: from mail-wr1-f68.google.com ([209.85.221.68]:44659 "EHLO mail-wr1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727565AbeJ3BNN (ORCPT ); Mon, 29 Oct 2018 21:13:13 -0400 Received: by mail-wr1-f68.google.com with SMTP id d17-v6so9081318wre.11 for ; Mon, 29 Oct 2018 09:23:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=yJCtkrkfIFoRj9cRN8aqIPKmbD9Nc3jaK1cwdarWAHs=; b=b9l2MmIpKRXHesHf2ofXp+b+1pZGE08G4PAHV2q0iy8mOYw7DmBHmPnxHI5pQmyaGT pblfRnf9cTpHs0a0e24oHPG5zHSCbap2kpRrYg6eUP7HJxXMaMWhi9NdjVW1nDDjFz9x zlOcJBtySx0RBYl5UYiiidYzf6roZaLuvmrRg= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=yJCtkrkfIFoRj9cRN8aqIPKmbD9Nc3jaK1cwdarWAHs=; b=fuhe/9GkHSDV5J18b4RqHbf7Gt3iv90F9ebd/rg4arVsFpRqC1ooLosnwigUHm4AkV AjxyT/VgzVB2ngzWADh12HjOKGUG0MF93NfUtM6Vn0GPzZUI1hpXqob1rSTb6p8OB89p NmHZuXH0s6s7aG8+WSwGGlWBjIH93PtuqEMSl5yEtrEUfxdT8RlcJVpNu0gjafffiX/4 4yXr1j8x92CxyZWMgjLk+3+gjwoH5mKBJY3UVMLgoXW8ZuJy0eNMyuEk4jL2CuNl79r9 ezzn+1e1NjvA3FKZhRZcIR4FglrsPMZW2ttpeyJNHfYgs/ZqIz4ObEa/T4rNCn5EYlDd 7MnQ== X-Gm-Message-State: AGRZ1gIn5ORQ2AbpM5ZJuj7pQzIXhkEyH8KLp7aoXx9KqDiMG59v+5sy Yjz/Ldjye3nSaPbfc7rpLmmIsQ== X-Received: by 2002:adf:e551:: with SMTP id z17-v6mr14524210wrm.238.1540830234197; Mon, 29 Oct 2018 09:23:54 -0700 (PDT) Received: from localhost.localdomain (137.55.88.92.rev.sfr.net. [92.88.55.137]) by smtp.gmail.com with ESMTPSA id y19-v6sm28150499wra.60.2018.10.29.09.23.52 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 29 Oct 2018 09:23:52 -0700 (PDT) From: Daniel Lezcano To: rjw@rjwysocki.net Cc: vincent.guittot@linaro.org, linux-kernel@vger.kernel.org, Greg Kroah-Hartman , "Rafael J. Wysocki" Subject: [PATCH 3/4] base/drivers/topology: Move instructions in the error path Date: Mon, 29 Oct 2018 17:23:19 +0100 Message-Id: <1540830201-2947-3-git-send-email-daniel.lezcano@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1540830201-2947-1-git-send-email-daniel.lezcano@linaro.org> References: <1540830201-2947-1-git-send-email-daniel.lezcano@linaro.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org When the function topology_parse_cpu_capacity() fails, we set the boolean cap_parsing_failed to true and we free the raw_capacity. This is correct as the function begins with a check against cap_parsing_failed thus protecting the function to be re-entered. However, even it is impossible that can happen with the current code, let's move in the instructions: - cap_parsing_failed = true; - free_raw_capacity(); ... in the 'else' block when the error is detected, that is more semantically correct. Signed-off-by: Daniel Lezcano --- drivers/base/arch_topology.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) -- 2.7.4 diff --git a/drivers/base/arch_topology.c b/drivers/base/arch_topology.c index b19d6d4..7311641 100644 --- a/drivers/base/arch_topology.c +++ b/drivers/base/arch_topology.c @@ -155,9 +155,9 @@ bool __init topology_parse_cpu_capacity(struct device_node *cpu_node, int cpu) pr_err("cpu_capacity: missing %pOF raw capacity\n", cpu_node); pr_err("cpu_capacity: partial information: fallback to 1024 for all CPUs\n"); + cap_parsing_failed = true; + free_raw_capacity(); } - cap_parsing_failed = true; - free_raw_capacity(); } return !ret;