From patchwork Tue Mar 15 14:41:22 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Randy Dunlap X-Patchwork-Id: 551460 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E762FC433EF for ; Tue, 15 Mar 2022 14:41:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1349342AbiCOOmi (ORCPT ); Tue, 15 Mar 2022 10:42:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35794 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239969AbiCOOmh (ORCPT ); Tue, 15 Mar 2022 10:42:37 -0400 Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:e::133]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 55CB75575C; Tue, 15 Mar 2022 07:41:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Content-Transfer-Encoding: MIME-Version:Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To:Content-Type: Content-ID:Content-Description:In-Reply-To:References; bh=NzRQEYorEzhHA8+YGei5in7doe6fNvniOav5T3IGlHI=; b=iywvkP5vvRsHHWJPUl8sHRfV5L Iqwe3lhwZ37xHttx2D+ENj+YKRPQissd/3nRrzKDY6Er0bDWFLBRLHBGGTWrr6q424/BAj2K6jxvx SnEzqpL2V8luY2VWFkxaeLuD+TSwl3yD9fzCpPjOge0FyJMhrgtttI/1hBatsRB98ZmbhrjAmF3YJ 5re6wc+TFUOykMqPIGyHmxslYaow3Lah6mrfkIOQAhp6OHeIyCV04F5lxZJxETCyeAmbzbLjmEear 979FeKg7sk6k0imCS4xKb+vIaSBsLCSEbFeideWGtoFmjGNvBCOxHIKWw0w26/MvLeyQf/rOMttUX n46f/Q4w==; Received: from [2601:1c0:6280:3f0::aa0b] (helo=bombadil.infradead.org) by bombadil.infradead.org with esmtpsa (Exim 4.94.2 #2 (Red Hat Linux)) id 1nU8MV-009VjT-Ix; Tue, 15 Mar 2022 14:41:23 +0000 From: Randy Dunlap To: linux-kernel@vger.kernel.org Cc: Randy Dunlap , Dan Carpenter , John Stultz , Daniel Lezcano , Thomas Gleixner , "Rafael J. Wysocki" , linux-acpi@vger.kernel.org Subject: [PATCH v3] clocksource: acpi_pm: fix return value of __setup handler Date: Tue, 15 Mar 2022 07:41:22 -0700 Message-Id: <20220315144122.23144-1-rdunlap@infradead.org> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org __setup() handlers should return 1 to obsolete_checksetup() in init/main.c to indicate that the boot option has been handled. A return of 0 causes the boot option/value to be listed as an Unknown kernel parameter and added to init's (limited) environment strings. The __setup() handler interface isn't meant to handle negative return values -- they are non-zero, so they mean "handled" (like a return value of 1 does), but that's just a quirk. So return 1 from parse_pmtmr(). Also print a warning message if kstrtouint() returns an error. Fixes: 6b148507d3d0 ("pmtmr: allow command line override of ioport") Signed-off-by: Randy Dunlap From: Igor Zhbanov Link: lore.kernel.org/r/64644a2f-4a20-bab3-1e15-3b2cdd0defe3@omprussia.ru Cc: Dan Carpenter Cc: John Stultz Cc: Daniel Lezcano Cc: Thomas Gleixner Cc: "Rafael J. Wysocki" Cc: linux-acpi@vger.kernel.org --- v3: also cc: linux-acpi (Rafael) v2: correct the Fixes: tag (Dan Carpenter) drivers/clocksource/acpi_pm.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) --- linux-next-20220315.orig/drivers/clocksource/acpi_pm.c +++ linux-next-20220315/drivers/clocksource/acpi_pm.c @@ -229,8 +229,10 @@ static int __init parse_pmtmr(char *arg) int ret; ret = kstrtouint(arg, 16, &base); - if (ret) - return ret; + if (ret) { + pr_warn("PMTMR: invalid 'pmtmr=' value: '%s'\n", arg); + return 1; + } pr_info("PMTMR IOPort override: 0x%04x -> 0x%04x\n", pmtmr_ioport, base);