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]
Date:	Thu, 13 Mar 2014 09:07:10 +0100
From:	Thierry Reding <thierry.reding@...il.com>
To:	Dmitry Eremin-Solenikov <dbaryshkov@...il.com>,
	David Woodhouse <dwmw2@...radead.org>
Cc:	linux-kernel@...r.kernel.org
Subject: [PATCH 1/2] power: bq24190: Remove gratuitous dummy function

From: Thierry Reding <treding@...dia.com>

Check for OF support using IS_ENABLED(CONFIG_OF). This will enable the
compiler to eliminate dead code if OF support is disabled. With that in
place, the dummy implementation of bq24190_setup_dt() for non-DT setups
can be removed as the compiler will automatically discard the function
when appropriate.

Signed-off-by: Thierry Reding <treding@...dia.com>
---
 drivers/power/bq24190_charger.c | 9 +--------
 1 file changed, 1 insertion(+), 8 deletions(-)

diff --git a/drivers/power/bq24190_charger.c b/drivers/power/bq24190_charger.c
index ad3ff8fbfbbb..f5b21c0d0ba3 100644
--- a/drivers/power/bq24190_charger.c
+++ b/drivers/power/bq24190_charger.c
@@ -1312,7 +1312,6 @@ out:
 	return ret;
 }
 
-#ifdef CONFIG_OF
 static int bq24190_setup_dt(struct bq24190_dev_info *bdi)
 {
 	bdi->irq = irq_of_parse_and_map(bdi->dev->of_node, 0);
@@ -1321,12 +1320,6 @@ static int bq24190_setup_dt(struct bq24190_dev_info *bdi)
 
 	return 0;
 }
-#else
-static int bq24190_setup_dt(struct bq24190_dev_info *bdi)
-{
-	return -1;
-}
-#endif
 
 static int bq24190_setup_pdata(struct bq24190_dev_info *bdi,
 		struct bq24190_platform_data *pdata)
@@ -1388,7 +1381,7 @@ static int bq24190_probe(struct i2c_client *client,
 
 	i2c_set_clientdata(client, bdi);
 
-	if (dev->of_node)
+	if (IS_ENABLED(CONFIG_OF) && dev->of_node)
 		ret = bq24190_setup_dt(bdi);
 	else
 		ret = bq24190_setup_pdata(bdi, pdata);
-- 
1.8.4.2

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ