From patchwork Thu Mar 17 15:39:39 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Randy Dunlap X-Patchwork-Id: 552277 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 3B215C433EF for ; Thu, 17 Mar 2022 15:39:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236029AbiCQPlE (ORCPT ); Thu, 17 Mar 2022 11:41:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42220 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236013AbiCQPlB (ORCPT ); Thu, 17 Mar 2022 11:41:01 -0400 Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:e::133]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CA7C220D516; Thu, 17 Mar 2022 08:39:43 -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=w7LH+XYgp1TElmi+XKfDK45mdQpBTmiaAJ1ksWS+y2s=; b=LaJzz1HoN9jfolmpLabHmiD5eS 0KpDGuHsmyUf2nmdOjeSUH9westzvWmXaQ/JrKCxkAGxmmQ2/hjVh3ERqdl9PYEOTXTnjC4nt06ay 2sh/4VaMfZlcZHNLowiB9JvNP2eTtoUKiIJ1TUHUMZpX2ftejGT3OWWEN1XzSSak04dO+89BpAarm BtNW4uJJKc7xfRl/i4PcXCbTBxksqJ6nGzOhNkpe87qMWByTo/lHTHKyNiFOu4oGsN8Aio1VhsdNE lvXt+00dGfrWe0OZbmZZB0WXlrERsBfdkf04i+uvlc1AnFupMh/3AAMKEKg0u7YOpY812lSatQq6C W3l/uXlg==; 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 1nUsDz-00GeUK-Uv; Thu, 17 Mar 2022 15:39:40 +0000 From: Randy Dunlap To: linux-kernel@vger.kernel.org Cc: Randy Dunlap , Igor Zhbanov , Dan Carpenter , Daniel Lezcano , Thomas Gleixner , "Rafael J. Wysocki" , linux-acpi@vger.kernel.org Subject: [PATCH v4] clocksource: acpi_pm: fix return value of __setup handler Date: Thu, 17 Mar 2022 08:39:39 -0700 Message-Id: <20220317153939.31542-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 Reported-by: Igor Zhbanov Link: lore.kernel.org/r/64644a2f-4a20-bab3-1e15-3b2cdd0defe3@omprussia.ru Cc: Dan Carpenter Cc: Daniel Lezcano Cc: Thomas Gleixner Cc: "Rafael J. Wysocki" Cc: linux-acpi@vger.kernel.org --- v4: correct Igor's email address to be Reported-by: (Rafael) v3: also cc: linux-acpi (Rafael) v2: correct the Fixes: tag (Dan Carpenter); remove Cc: John Stultz (bouncing) 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);