From patchwork Tue Dec 5 14:37:26 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Carpenter X-Patchwork-Id: 10093041 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 0823960327 for ; Tue, 5 Dec 2017 14:38:28 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B04A3288ED for ; Tue, 5 Dec 2017 14:38:27 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A29712895A; Tue, 5 Dec 2017 14:38:27 +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=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI, T_DKIM_INVALID, UNPARSEABLE_RELAY 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 E2244288ED for ; Tue, 5 Dec 2017 14:38:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751255AbdLEOiY (ORCPT ); Tue, 5 Dec 2017 09:38:24 -0500 Received: from userp2130.oracle.com ([156.151.31.86]:33733 "EHLO userp2130.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752785AbdLEOiU (ORCPT ); Tue, 5 Dec 2017 09:38:20 -0500 Received: from pps.filterd (userp2130.oracle.com [127.0.0.1]) by userp2130.oracle.com (8.16.0.21/8.16.0.21) with SMTP id vB5EauTg148919; Tue, 5 Dec 2017 14:37:35 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=date : from : to : cc : subject : message-id : mime-version : content-type; s=corp-2017-10-26; bh=2Iy3xlt3RzLzk8Lt2ZjQaWI9BCbI5im5zRHJIyN2v8c=; b=j6g6jMN9nod1f1CxsxRCAMCZ7dNZnehpCvMn+kwtP6iIn/hwtFZ2Rshf9CKShkOcp4T/ R7WC2yK3M5DO3bulqXgFLx5cs4AB6V193tPz7eVolEQBF6nCuVenAGqHq3ZZMVxx5jzC 7pP8Yp3y4DLtAz3fz1EMkskjUuTTsaBrNSz4ghTjJggpuDpz9OX+xiWQMoBh8YKRmZCO Zpm7ZbBPTD+bAvsvB8aei+MchJMxaBVVsj6TD//9ECmUeTw1VOG2C2cL4OeLLjZ5piqx N+nEiDHoc1/3Sa0sNKcDIhPJ/1PwN2xmDiW7nvo+8TUI+cDIesgAjyEe2PgJagTtOyq7 KQ== Received: from aserv0021.oracle.com (aserv0021.oracle.com [141.146.126.233]) by userp2130.oracle.com with ESMTP id 2ekpeyq39s-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 05 Dec 2017 14:37:35 +0000 Received: from aserv0122.oracle.com (aserv0122.oracle.com [141.146.126.236]) by aserv0021.oracle.com (8.14.4/8.14.4) with ESMTP id vB5EbYe5001832 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 5 Dec 2017 14:37:34 GMT Received: from abhmp0004.oracle.com (abhmp0004.oracle.com [141.146.116.10]) by aserv0122.oracle.com (8.14.4/8.14.4) with ESMTP id vB5EbX1Z013047; Tue, 5 Dec 2017 14:37:34 GMT Received: from mwanda (/197.157.0.30) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Tue, 05 Dec 2017 06:37:33 -0800 Date: Tue, 5 Dec 2017 17:37:26 +0300 From: Dan Carpenter To: Jean Delvare , Lei YU Cc: Guenter Roeck , linux-hwmon@vger.kernel.org, kernel-janitors@vger.kernel.org Subject: [PATCH] hwmon: (w83773g) Fix a precedence bug in get_fault() Message-ID: <20171205143726.d3tziwhjboyfxmgi@mwanda> MIME-Version: 1.0 Content-Disposition: inline X-Mailer: git-send-email haha only kidding User-Agent: NeoMutt/20170609 (1.8.3) X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=8735 signatures=668637 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 suspectscore=0 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1709140000 definitions=main-1712050211 Sender: linux-hwmon-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-hwmon@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Shift has higher precedence than mask but presumably we wanted to set *val to 1 if BIT(2) was set or 0 if the bit was clear. Fixes: de0a524e3e09 ("hwmon: Add W83773G driver") Signed-off-by: Dan Carpenter --- To unsubscribe from this list: send the line "unsubscribe linux-hwmon" 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/hwmon/w83773g.c b/drivers/hwmon/w83773g.c index 0b97c285b049..e858093ac806 100644 --- a/drivers/hwmon/w83773g.c +++ b/drivers/hwmon/w83773g.c @@ -102,7 +102,7 @@ static int get_fault(struct regmap *regmap, int index, long *val) if (ret < 0) return ret; - *val = (u8)regval & 0x04 >> 2; + *val = (regval & 0x04) >> 2; return 0; }