From patchwork Wed Jan 10 12:29:11 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Carpenter X-Patchwork-Id: 10155049 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 01C0A605BA for ; Wed, 10 Jan 2018 12:29:28 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E1A7022380 for ; Wed, 10 Jan 2018 12:29:27 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D644B24151; Wed, 10 Jan 2018 12:29: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=-1.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_NONE, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=no version=3.3.1 Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 87DAB228C9 for ; Wed, 10 Jan 2018 12:29:26 +0000 (UTC) Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id D2DC02677A2; Wed, 10 Jan 2018 13:29:24 +0100 (CET) X-Original-To: alsa-devel@alsa-project.org Delivered-To: alsa-devel@alsa-project.org Received: by alsa0.perex.cz (Postfix, from userid 1000) id 774A42677A8; Wed, 10 Jan 2018 13:29:23 +0100 (CET) Received: from userp2120.oracle.com (userp2120.oracle.com [156.151.31.85]) by alsa0.perex.cz (Postfix) with ESMTP id 7412C266DEC for ; Wed, 10 Jan 2018 13:29:20 +0100 (CET) Received: from pps.filterd (userp2120.oracle.com [127.0.0.1]) by userp2120.oracle.com (8.16.0.22/8.16.0.22) with SMTP id w0ACQeVd110467; Wed, 10 Jan 2018 12:29:20 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 : in-reply-to; s=corp-2017-10-26; bh=iTbJDkwCjFxF8kgmGPrCzy/X/ze2mgAFHArIz2B9tok=; b=NnFJ+tYIb+Ca+WneZR8P5dJtmIi+fUuOk4u+MWIUqGXtN53NFYaYQonady8V/Ni6CGTi uJIagukdG+c8/7KkBsiYN0N9vaINkHmnEA/BAO33QXaCeEMOnC/6HgiJb6X1vsys92lM gnKOlakfsm6osxdKvPHhv3p8hHgx+FgnspfZIiNCInVaKDS56U9irTQgsh5r/qjQL2Ew Eu3l0gZhrG9Cp0CIlL8+8wYIM5nSefgz6trUkGtepgEVnclIKz2DPPYlLFYayLrv7T6c q+gNpPfkY0oIK+HN7Q0XrC49ooDlit8X0aGHOuXKWaJorR2M84QKKkZYj+prZEjL/Yux cg== Received: from userv0022.oracle.com (userv0022.oracle.com [156.151.31.74]) by userp2120.oracle.com with ESMTP id 2fdj5e87gr-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 10 Jan 2018 12:29:19 +0000 Received: from userv0121.oracle.com (userv0121.oracle.com [156.151.31.72]) by userv0022.oracle.com (8.14.4/8.14.4) with ESMTP id w0ACTJ88020370 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Wed, 10 Jan 2018 12:29:19 GMT Received: from abhmp0016.oracle.com (abhmp0016.oracle.com [141.146.116.22]) by userv0121.oracle.com (8.14.4/8.13.8) with ESMTP id w0ACTJSQ026413; Wed, 10 Jan 2018 12:29:19 GMT Received: from mwanda (/41.202.241.23) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Wed, 10 Jan 2018 04:29:18 -0800 Date: Wed, 10 Jan 2018 15:29:11 +0300 From: Dan Carpenter To: Vinod Koul Message-ID: <20180110122911.tsd4h7vc65ormdbx@mwanda> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20180110105425.GY18649@localhost> X-Mailer: git-send-email haha only kidding User-Agent: NeoMutt/20170609 (1.8.3) X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=8769 signatures=668652 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=842 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1711220000 definitions=main-1801100175 Cc: Sanyog Kale , kernel-janitors@vger.kernel.org, alsa-devel@alsa-project.org Subject: [alsa-devel] [PATCH v2] soundwire: Fix a signedness bug X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.org X-Virus-Scanned: ClamAV using ClamSMTP "ret" is an int and "buf" is a u8. sdw_read() returns negative error codes which are truncated to the u8, 0-255 range before being stored as an int. It means that "ret" can't be less than zero. Fixes: b0a9c37b0178 ("soundwire: Add slave status handling") Signed-off-by: Dan Carpenter --- v2: style change diff --git a/drivers/soundwire/bus.c b/drivers/soundwire/bus.c index 4c345197eb55..ae698e63bdf6 100644 --- a/drivers/soundwire/bus.c +++ b/drivers/soundwire/bus.c @@ -771,7 +771,7 @@ static int sdw_handle_slave_alerts(struct sdw_slave *slave) sdw_modify_slave_status(slave, SDW_SLAVE_ALERT); /* Read Instat 1, Instat 2 and Instat 3 registers */ - ret = buf = sdw_read(slave, SDW_SCP_INT1); + buf = ret = sdw_read(slave, SDW_SCP_INT1); if (ret < 0) { dev_err(slave->bus->dev, "SDW_SCP_INT1 read failed:%d", ret); @@ -870,7 +870,7 @@ static int sdw_handle_slave_alerts(struct sdw_slave *slave) * Read status again to ensure no new interrupts arrived * while servicing interrupts. */ - ret = _buf = sdw_read(slave, SDW_SCP_INT1); + _buf = ret = sdw_read(slave, SDW_SCP_INT1); if (ret < 0) { dev_err(slave->bus->dev, "SDW_SCP_INT1 read failed:%d", ret);