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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-id: <1397475984-28001-8-git-send-email-r.baldyga@samsung.com>
Date:	Mon, 14 Apr 2014 13:46:18 +0200
From:	Robert Baldyga <r.baldyga@...sung.com>
To:	unlisted-recipients:; (no To-header on input)
Cc:	robh+dt@...nel.org, pawel.moll@....com, mark.rutland@....com,
	ijc+devicetree@...lion.org.uk, galak@...eaurora.org,
	rob@...dley.net, myungjoo.ham@...sung.com, cw00.choi@...sung.com,
	dbaryshkov@...il.com, dwmw2@...radead.org, balbi@...com,
	gregkh@...uxfoundation.org, grant.likely@...aro.org,
	ldewangan@...dia.com, kishon@...com, gg@...mlogic.co.uk,
	anton@...msg.org, jonghwa3.lee@...sung.com, rongjun.ying@....com,
	linux@...ck-us.net, devicetree@...r.kernel.org,
	linux-doc@...r.kernel.org, linux-kernel@...r.kernel.org,
	patches@...nsource.wolfsonmicro.com, linux-usb@...r.kernel.org,
	linux-omap@...r.kernel.org, aaro.koskinen@....fi,
	m.szyprowski@...sung.com, t.figa@...sung.com,
	Robert Baldyga <r.baldyga@...sung.com>
Subject: [PATCH v2 07/13] extcon: extcon-class: improve
 get_cable_state_()/set_cable_state_() functions

Added check if pointer to edev is not NULL, and updated documentation of index
parameter. Function extcon_find_cable_index() has been deleted and cannot be
used to retrieve cable number.

Signed-off-by: Robert Baldyga <r.baldyga@...sung.com>
---
 drivers/extcon/extcon-class.c |    9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/drivers/extcon/extcon-class.c b/drivers/extcon/extcon-class.c
index 40a33e2..e9e5e85 100644
--- a/drivers/extcon/extcon-class.c
+++ b/drivers/extcon/extcon-class.c
@@ -285,10 +285,12 @@ EXPORT_SYMBOL_GPL(extcon_set_state);
 /**
  * extcon_get_cable_state_() - Get the status of a specific cable.
  * @edev:	the extcon device that has the cable.
- * @index:	cable index that can be retrieved by extcon_find_cable_index().
+ * @index:	cable index in extcon device.
  */
 int extcon_get_cable_state_(struct extcon_dev *edev, int index)
 {
+	if (!edev)
+		return -ENODEV;
 	if (index < 0 || (edev->max_supported && edev->max_supported <= index))
 		return -EINVAL;
 
@@ -312,8 +314,7 @@ EXPORT_SYMBOL_GPL(extcon_get_cable_state);
 /**
  * extcon_set_cable_state_() - Set the status of a specific cable.
  * @edev:		the extcon device that has the cable.
- * @index:		cable index that can be retrieved by
- *			extcon_find_cable_index().
+ * @index:		cable index in extcon device.
  * @cable_state:	the new cable status. The default semantics is
  *			true: attached / false: detached.
  */
@@ -322,6 +323,8 @@ int extcon_set_cable_state_(struct extcon_dev *edev,
 {
 	u32 state;
 
+	if (!edev)
+		return -ENODEV;
 	if (index < 0 || (edev->max_supported && edev->max_supported <= index))
 		return -EINVAL;
 
-- 
1.7.9.5

--
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