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>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20200420220421.171298-1-hdegoede@redhat.com>
Date:   Tue, 21 Apr 2020 00:04:21 +0200
From:   Hans de Goede <hdegoede@...hat.com>
To:     Darren Hart <dvhart@...radead.org>,
        Andy Shevchenko <andy@...radead.org>
Cc:     Hans de Goede <hdegoede@...hat.com>,
        platform-driver-x86@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: [PATCH] platform/x86: surface3_power: i2c_acpi_new_device() returns a PTR_ERR

i2c_acpi_new_device() never returns NULL, it either returns an i2c_client
or a PTR_ERR. Adjust the mshw0011_probe() error handling to take this
into account.

Note the goto out_err will cause i2c_unregister_device() to get called
even though the i2c_acpi_new_device() fails, this is ok as it accepts
a NULL pointer argument (and treats it as a no-op).

Signed-off-by: Hans de Goede <hdegoede@...hat.com>
---
 drivers/platform/x86/surface3_power.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/platform/x86/surface3_power.c b/drivers/platform/x86/surface3_power.c
index 946ac2dc08ae..32e6e86e27dd 100644
--- a/drivers/platform/x86/surface3_power.c
+++ b/drivers/platform/x86/surface3_power.c
@@ -522,8 +522,10 @@ static int mshw0011_probe(struct i2c_client *client)
 	strlcpy(board_info.type, "MSHW0011-bat0", I2C_NAME_SIZE);
 
 	bat0 = i2c_acpi_new_device(dev, 1, &board_info);
-	if (!bat0)
-		return -ENOMEM;
+	if (IS_ERR(bat0)) {
+		error = PTR_ERR(bat0);
+		goto out_err;
+	}
 
 	data->bat0 = bat0;
 	i2c_set_clientdata(bat0, data);
-- 
2.26.0

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ