From patchwork Sat Mar 10 20:43:53 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?TWljaGHFgiBLxJlwaWXFhA==?= X-Patchwork-Id: 10274335 X-Patchwork-Delegate: dvhart@infradead.org 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 2038F602BD for ; Sat, 10 Mar 2018 20:44:08 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0FAFA29448 for ; Sat, 10 Mar 2018 20:44:08 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0455C29462; Sat, 10 Mar 2018 20:44:08 +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=-7.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, 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 834DF29448 for ; Sat, 10 Mar 2018 20:44:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751206AbeCJUoG (ORCPT ); Sat, 10 Mar 2018 15:44:06 -0500 Received: from mail-lf0-f67.google.com ([209.85.215.67]:34009 "EHLO mail-lf0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750946AbeCJUoF (ORCPT ); Sat, 10 Mar 2018 15:44:05 -0500 Received: by mail-lf0-f67.google.com with SMTP id l191-v6so17837793lfe.1 for ; Sat, 10 Mar 2018 12:44:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kempniu.pl; s=google; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=1DBD9ZL5/tyZgKzoEclXhXUBcu1NqmejqU06qFjGyXI=; b=GyeftcJQs2L6ymevrWUL3quSL7wdGnCGRl3FVpcT5bJAVEMJB56/X8cyW0aE2DGq6I zrHB5D0bI1uJur/RWx4q1qB5bZqX9Af+MKg4Fvv3qdfgoPa9Y2cB4FSN2xM4pmRxNKFJ XvqK82CSfB6xnB5Xe70vI56TeIZryKRwyOLjE= 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:mime-version :content-transfer-encoding; bh=1DBD9ZL5/tyZgKzoEclXhXUBcu1NqmejqU06qFjGyXI=; b=ZTJ08+W9sSH4puRevhPwVVhDQLRWEskGLDEsXpEbbJQQSLDe3RnN9VQXmSUPthLY9P YJLCRiFGEMc1bWDq9F59FUhUmvB4nuei+BYAUdnui6h/qP+SrrisLCiBJMh7nKbUPxM7 ekZhDMeDwAnGaY7j4fupc7Qt2ZRm1TLKfS0kQ+SlPvzT6I7oQ9fWUh9MuuRpgHueTzxQ +fEC3XgoNpPfbOvNgiTaUCFLKQrAd1G164PPZ/7TzjYScZ2MnYfyPY59BvcOM3d8qfWk qhUPoO17Tukch0FVjy7Vn5wHVRz1+5xgYEp3bpsUkV4/LZ42gK1jOIxo1tqWmTmgb4F0 km1w== X-Gm-Message-State: AElRT7GaDQhU2GVh+c2rbFh1hIXgJrFMUW3nyQAOiAloLNVfftVVOa5u 0pWkqbsqj3kJi7G0VHAEmXdPZA== X-Google-Smtp-Source: AG47ELsvB4cMzUWbR5iJxroFZ4YxrQNGSsm2xRaPwZ4RGDYXqHaH5rU/9Ex6L6k/u0wfT3UwRuds2w== X-Received: by 10.46.4.74 with SMTP id 71mr1800813lje.51.1520714644395; Sat, 10 Mar 2018 12:44:04 -0800 (PST) Received: from kmp-mobile.hq.kempniu.pl (kmp-mobile.hq.kempniu.pl. [2001:470:64df:111::d0d7]) by smtp.googlemail.com with ESMTPSA id w204-v6sm917566lff.9.2018.03.10.12.44.03 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 10 Mar 2018 12:44:03 -0800 (PST) From: =?UTF-8?q?Micha=C5=82=20K=C4=99pie=C5=84?= To: Jonathan Woithe , Darren Hart , Andy Shevchenko Cc: Dan Carpenter , platform-driver-x86@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] platform/x86: fujitsu-laptop: Revert UNSUPPORTED_CMD back to an int Date: Sat, 10 Mar 2018 21:43:53 +0100 Message-Id: <20180310204353.9584-1-kernel@kempniu.pl> X-Mailer: git-send-email 2.16.2 MIME-Version: 1.0 Sender: platform-driver-x86-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: platform-driver-x86@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP UNSUPPORTED_CMD was previously 0x80000000 (int), but commit 819cddae7cfa ("platform/x86: fujitsu-laptop: Clean up constants") changed it into an unsigned long due to BIT() being used to define it. As call_fext_func() returns an int, 0x80000000 would get type promoted when compared to an unsigned long, which on a 64-bit system would cause it to become 0xffffffff80000000 due to sign extension. This causes one logical condition in fujitsu-laptop to always be true and another one to always be false on 64-bit systems. Fix this by reverting UNSUPPORTED_CMD back to an int. This patch fixes the following smatch warnings: drivers/platform/x86/fujitsu-laptop.c:763 acpi_fujitsu_laptop_leds_register() warn: always true condition '(call_fext_func(device, ((1 << (12)) | (1 << (0))), 2, (1 << (16)), 0) != (1 << (31))) => (s32min-s32max != 2147483648)' drivers/platform/x86/fujitsu-laptop.c:816 acpi_fujitsu_laptop_add() warn: impossible condition '(priv->flags_supported == (1 << (31))) => (0-2147483647,18446744071562067968-u64max == 2147483648)' Fixes: 819cddae7cfa ("platform/x86: fujitsu-laptop: Clean up constants") Reported-by: Dan Carpenter Signed-off-by: Michał Kępień Reviewed-by: Jonathan Woithe --- This fixes a bug introduced by a commit queued for 4.17, so it needs to be applied on top of for-next. drivers/platform/x86/fujitsu-laptop.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/platform/x86/fujitsu-laptop.c b/drivers/platform/x86/fujitsu-laptop.c index 13bcdfea5349..6f4a55a53ced 100644 --- a/drivers/platform/x86/fujitsu-laptop.c +++ b/drivers/platform/x86/fujitsu-laptop.c @@ -85,7 +85,7 @@ #define FUNC_BACKLIGHT (BIT(12) | BIT(2)) /* FUNC interface - responses */ -#define UNSUPPORTED_CMD BIT(31) +#define UNSUPPORTED_CMD 0x80000000 /* FUNC interface - status flags */ #define FLAG_RFKILL BIT(5)