lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Message-Id: <1515473146-2871-1-git-send-email-vinod.koul@intel.com>
Date:   Tue,  9 Jan 2018 10:15:46 +0530
From:   Vinod Koul <vinod.koul@...el.com>
To:     Greg KH <gregkh@...uxfoundation.org>
Cc:     LKML <linux-kernel@...r.kernel.org>,
        Pierre-Louis Bossart <pierre-louis.bossart@...ux.intel.com>,
        Sanyog Kale <sanyog.r.kale@...el.com>,
        Shreyas NC <shreyas.nc@...el.com>,
        Vinod Koul <vinod.koul@...el.com>
Subject: [PATCH] soundwire: Fix incorrect return value check

From: Shreyas NC <shreyas.nc@...el.com>

pm_runtime_get_sync will return negative values for error
and 0 or 1 for success. Update the error check accordingly.

Signed-off-by: Shreyas NC <shreyas.nc@...el.com>
Reported-by: Dan Carpenter <dan.carpenter@...cle.com>
Fixes: 9d715fa005eb: ("soundwire: Add IO transfer")
Signed-off-by: Vinod Koul <vinod.koul@...el.com>
---
 drivers/soundwire/bus.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/soundwire/bus.c b/drivers/soundwire/bus.c
index 03313590b661..5d7226c251e6 100644
--- a/drivers/soundwire/bus.c
+++ b/drivers/soundwire/bus.c
@@ -305,7 +305,7 @@ int sdw_nread(struct sdw_slave *slave, u32 addr, size_t count, u8 *val)
 		return ret;
 
 	ret = pm_runtime_get_sync(slave->bus->dev);
-	if (!ret)
+	if (ret < 0)
 		return ret;
 
 	ret = sdw_transfer(slave->bus, &msg);
@@ -333,7 +333,7 @@ int sdw_nwrite(struct sdw_slave *slave, u32 addr, size_t count, u8 *val)
 		return ret;
 
 	ret = pm_runtime_get_sync(slave->bus->dev);
-	if (!ret)
+	if (ret < 0)
 		return ret;
 
 	ret = sdw_transfer(slave->bus, &msg);
-- 
2.7.4

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ