From patchwork Thu Aug 25 08:42:39 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Shi X-Patchwork-Id: 74668 Delivered-To: patch@linaro.org Received: by 10.140.29.52 with SMTP id a49csp725489qga; Thu, 25 Aug 2016 01:43:43 -0700 (PDT) X-Received: by 10.98.93.25 with SMTP id r25mr13934396pfb.122.1472114623679; Thu, 25 Aug 2016 01:43:43 -0700 (PDT) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id o1si14455073pfb.295.2016.08.25.01.43.42; Thu, 25 Aug 2016 01:43:43 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-pm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org; spf=pass (google.com: best guess record for domain of linux-pm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-pm-owner@vger.kernel.org; dmarc=fail (p=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933621AbcHYInl (ORCPT + 14 others); Thu, 25 Aug 2016 04:43:41 -0400 Received: from mail-pf0-f181.google.com ([209.85.192.181]:35563 "EHLO mail-pf0-f181.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933610AbcHYInk (ORCPT ); Thu, 25 Aug 2016 04:43:40 -0400 Received: by mail-pf0-f181.google.com with SMTP id x72so15906151pfd.2 for ; Thu, 25 Aug 2016 01:42:49 -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; bh=re1M9iR1hydVXgop/uTuzPGvYpXEFy0rU4HYVf/7Wv8=; b=MlqDMlZ7POMXsr3DB/vic9+MyITph0EbNhrInn12hpFRKwnyZy8ghfYX1zrSq9pJvS kFUU5uzEk/2dvoUWe949HvlnCBBjjjV9u/v/5d6j+E53yDgyU06v5x4H92mscOTlljlV RJ9/uJAL7bTayPcwXMA/OthmGSWHwfuH9EARM= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=re1M9iR1hydVXgop/uTuzPGvYpXEFy0rU4HYVf/7Wv8=; b=nNFEzr+aV6bkkV8X+EaTS9PHY1QyKoZVpvhnH7WovMILgbeteZ2oKHwQhAcM+DRgg/ ntHgPutdkK0WDd9KUJcW7TdQ2j+8HIjtcQll7G9P3PFja3NFSRNzo7Yq9J+uHK+EFo7L lrwnmntG7nkQGxg3Dqyb7GL++emYrJ3fxV+b8URdvBn5rHaAUpZNrFSBltRVVieIOKAo pIfC1qfpCdAZVV6cqfudbkaEKqTyqX9nKEabVx9TK575mmLEVBmEgvSKowyCHHv1ToZb 0CJ9bNIgbfdhACqelt4/uvqxRC+4jiJTxyDZTTziN9/Yh4DA1ZXFG0+Y/YcG52k+x59L +q+w== X-Gm-Message-State: AE9vXwPi3/AQBUj79nB/xh8wtAIU/ltWtw9QYvLBkZYTpiVWYxbN7K/cnUExmvU6zADGwGWJ X-Received: by 10.98.21.131 with SMTP id 125mr14019224pfv.92.1472114568912; Thu, 25 Aug 2016 01:42:48 -0700 (PDT) Received: from localhost.localdomain ([139.59.249.186]) by smtp.gmail.com with ESMTPSA id h66sm19016433pfe.58.2016.08.25.01.42.46 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 25 Aug 2016 01:42:48 -0700 (PDT) From: Alex Shi To: Greg Kroah-Hartman , linux-kernel@vger.kernel.org (open list) Cc: linux-pm@vger.kernel.org, Ulf Hansson , Daniel Lezcano Subject: [PATCH 1/4] cpu: clean up register_cpu func Date: Thu, 25 Aug 2016 16:42:39 +0800 Message-Id: <1472114562-2736-1-git-send-email-alex.shi@linaro.org> X-Mailer: git-send-email 2.8.1.101.g72d917a Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org This patch could reduce one branch in this function. Also make the code more readble. Signed-off-by: Alex Shi Acked-by: Daniel Lezcano To: linux-kernel@vger.kernel.org To: Greg Kroah-Hartman Cc: linux-pm@vger.kernel.org Cc: Ulf Hansson Cc: Daniel Lezcano --- drivers/base/cpu.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) -- 2.8.1.101.g72d917a -- To unsubscribe from this list: send the line "unsubscribe linux-pm" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/base/cpu.c b/drivers/base/cpu.c index 691eeea..4c28e1a 100644 --- a/drivers/base/cpu.c +++ b/drivers/base/cpu.c @@ -371,12 +371,13 @@ int register_cpu(struct cpu *cpu, int num) if (cpu->hotpluggable) cpu->dev.groups = hotplugable_cpu_attr_groups; error = device_register(&cpu->dev); - if (!error) - per_cpu(cpu_sys_devices, num) = &cpu->dev; - if (!error) - register_cpu_under_node(num, cpu_to_node(num)); + if (error) + return error; - return error; + per_cpu(cpu_sys_devices, num) = &cpu->dev; + register_cpu_under_node(num, cpu_to_node(num)); + + return 0; } struct device *get_cpu_device(unsigned cpu)