From patchwork Sat Sep 27 23:28:43 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Rafael J. Wysocki" X-Patchwork-Id: 4990671 Return-Path: X-Original-To: patchwork-linux-acpi@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 689E8BEEA6 for ; Sat, 27 Sep 2014 23:09:15 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 89E7B202E6 for ; Sat, 27 Sep 2014 23:09:14 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 4F1D920274 for ; Sat, 27 Sep 2014 23:09:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753245AbaI0XIw (ORCPT ); Sat, 27 Sep 2014 19:08:52 -0400 Received: from v094114.home.net.pl ([79.96.170.134]:54850 "HELO v094114.home.net.pl" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with SMTP id S1753224AbaI0XIv (ORCPT ); Sat, 27 Sep 2014 19:08:51 -0400 Received: from aavx138.neoplus.adsl.tpnet.pl [83.6.57.138] (HELO vostro.rjw.lan) by serwer1319399.home.pl [79.96.170.134] with SMTP (IdeaSmtpServer v0.80) id fd83e9033c994db6; Sun, 28 Sep 2014 01:08:50 +0200 From: "Rafael J. Wysocki" To: ACPI Devel Maling List Cc: Linux Kernel Mailing List , Matthew Garrett , Andreas Noever Subject: [PATCH] ACPI / SBS: Fix check in acpi_ac_get_present() Date: Sun, 28 Sep 2014 01:28:43 +0200 Message-ID: <1539043.bcCaecDElK@vostro.rjw.lan> User-Agent: KMail/4.11.5 (Linux/3.16.0-rc5+; KDE/4.11.5; x86_64; ; ) MIME-Version: 1.0 Sender: linux-acpi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org X-Spam-Status: No, score=-7.8 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Rafael J. Wysocki Parentheses are missing under an if () statement in acpi_ac_get_present() which makes the check work differently from what was intended (at least according to the comment right above it). Add the missing parens. The problem was found by sparse. Signed-off-by: Rafael J. Wysocki --- drivers/acpi/sbs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- To unsubscribe from this list: send the line "unsubscribe linux-acpi" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Index: linux-pm/drivers/acpi/sbs.c =================================================================== --- linux-pm.orig/drivers/acpi/sbs.c +++ linux-pm/drivers/acpi/sbs.c @@ -441,7 +441,7 @@ static int acpi_ac_get_present(struct ac * The spec requires that bit 4 always be 1. If it's not set, assume * that the implementation doesn't support an SBS charger */ - if (!(status >> 4) & 0x1) + if (!((status >> 4) & 0x1)) return -ENODEV; sbs->charger_present = (status >> 15) & 0x1;