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-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20171108155020.3851-4-andi@etezian.org>
Date:   Wed,  8 Nov 2017 17:50:20 +0200
From:   Andi Shyti <andi@...zian.org>
To:     Dmitry Torokhov <dmitry.torokhov@...il.com>
Cc:     Michael Hennerich <michael.hennerich@...log.com>,
        Lars-Peter Clausen <lars@...afoo.de>,
        linux-input@...r.kernel.org, linux-kernel@...r.kernel.org,
        Andi Shyti <andi@...zian.org>,
        Andi Shyti <andi.shyti@...sung.com>
Subject: [PATCH v3 3/3] Input: ad7897 - use separate error handling for different allocators

Split the error between devm_kzalloc and
devm_input_allocate_device, there is no need to call the second
allocator if the first has failed. Besides this doesn't provide
practical advantages.

CC: Michael Hennerich <michael.hennerich@...log.com>
Signed-off-by: Andi Shyti <andi@...zian.org>
---
 drivers/input/touchscreen/ad7877.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/input/touchscreen/ad7877.c b/drivers/input/touchscreen/ad7877.c
index 04ab8fbc8184..98deffde3fe2 100644
--- a/drivers/input/touchscreen/ad7877.c
+++ b/drivers/input/touchscreen/ad7877.c
@@ -710,8 +710,11 @@ static int ad7877_probe(struct spi_device *spi)
 	}
 
 	ts = devm_kzalloc(&spi->dev, sizeof(struct ad7877), GFP_KERNEL);
+	if (!ts)
+		return -ENOMEM;
+
 	input_dev = devm_input_allocate_device(&spi->dev);
-	if (!ts || !input_dev)
+	if (!input_dev)
 		return -ENOMEM;
 
 	err = devm_add_action_or_reset(&spi->dev, ad7877_disable, ts);
-- 
2.15.0

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ