devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 00/13] 3.19 st21nfc fixes
@ 2015-01-25 22:33 Christophe Ricard
       [not found] ` <1422225211-27510-1-git-send-email-christophe-h.ricard-qxv4g6HH51o@public.gmane.org>
  0 siblings, 1 reply; 15+ messages in thread
From: Christophe Ricard @ 2015-01-25 22:33 UTC (permalink / raw)
  To: sameo-VuQAYsv1563Yd54FQh9/CA
  Cc: linux-nfc-hn68Rpc1hR1g9hUCZPvPmw,
	christophe.ricard-Re5JQEeQqe8AvxtiuMwx3w,
	christophe-h.ricard-qxv4g6HH51o,
	devicetree-u79uwXL29TY76Z2rM5mHXA

Hi,

Please find in the following series a set of fixes found during the
3.19 window merge timeframe by Dan Carpenter, Julia Lawall, Anda-Maria Nicolae
or myself.

Some of those patches are taken out of the serie sent in December 2014:
https://lists.01.org/pipermail/linux-nfc/2014-December/003204.html

They were mixing new features and fixes.

Hope those fixes can join kernel revision 3.19.

2 others series will be sent later for secure element support for st21nfca and
for st21nfcb.

Best Regards
Christophe
 
Christophe Ricard (13):
  NFC: dts: st21nfca: Fix compatible string spelling to follow other
    drivers
  NFC: dts: st21nfcb: Fix compatible string spelling to follow other
    drivers
  NFC: st21nfcb: Fix "WARNING: invalid free of devm_ allocated data"
  NFC: st21nfca: Remove unreachable code
  NFC: st21nfcb: Avoid use of skb after free
  NFC: nfc_enable_se Remove useless blank line at beginning of function
  NFC: nfc_disable_se Remove useless blank line at beginning of function
  NFC: st21nfca: Remove skb_pipe_list and skb_pipe_info useless
    allocation
  NFC: st21nfca: Remove checkpatch.pl warning Possible unnecessary 'out
    of memory' message
  NFC: st21nfca: Fix some skb memory leaks
  NFC: st21nfcb: Fix "NULL pointer dereference" possible error
  NFC: st21nfcb: Remove useless include
  NFC: st21nfcb: Fix copy/paste error in comment

 .../devicetree/bindings/net/nfc/st21nfca.txt       |  4 +-
 .../devicetree/bindings/net/nfc/st21nfcb.txt       |  4 +-
 drivers/nfc/st21nfca/i2c.c                         |  6 +--
 drivers/nfc/st21nfca/st21nfca.c                    | 52 +++++++++-------------
 drivers/nfc/st21nfcb/i2c.c                         | 19 +++++---
 drivers/nfc/st21nfcb/ndlc.c                        |  3 +-
 include/linux/platform_data/st21nfcb.h             |  4 +-
 net/nfc/core.c                                     |  2 -
 8 files changed, 41 insertions(+), 53 deletions(-)

-- 
2.1.0

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 15+ messages in thread

* [PATCH 01/13] NFC: dts: st21nfca: Fix compatible string spelling to follow other drivers
       [not found] ` <1422225211-27510-1-git-send-email-christophe-h.ricard-qxv4g6HH51o@public.gmane.org>
@ 2015-01-25 22:33   ` Christophe Ricard
  2015-01-25 22:33   ` [PATCH 02/13] NFC: dts: st21nfcb: " Christophe Ricard
                     ` (12 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: Christophe Ricard @ 2015-01-25 22:33 UTC (permalink / raw)
  To: sameo-VuQAYsv1563Yd54FQh9/CA
  Cc: linux-nfc-hn68Rpc1hR1g9hUCZPvPmw,
	christophe.ricard-Re5JQEeQqe8AvxtiuMwx3w,
	christophe-h.ricard-qxv4g6HH51o,
	devicetree-u79uwXL29TY76Z2rM5mHXA

Other drivers are following the following compatible string format for dts:
s/_/-/

Because some devices may still use the previous string, the new corrected
string is added to the of_device_id table.

Signed-off-by: Christophe Ricard <christophe-h.ricard-qxv4g6HH51o@public.gmane.org>
---
 Documentation/devicetree/bindings/net/nfc/st21nfca.txt | 4 ++--
 drivers/nfc/st21nfca/i2c.c                             | 1 +
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/Documentation/devicetree/bindings/net/nfc/st21nfca.txt b/Documentation/devicetree/bindings/net/nfc/st21nfca.txt
index e4faa2e..db677fe 100644
--- a/Documentation/devicetree/bindings/net/nfc/st21nfca.txt
+++ b/Documentation/devicetree/bindings/net/nfc/st21nfca.txt
@@ -1,7 +1,7 @@
 * STMicroelectronics SAS. ST21NFCA NFC Controller
 
 Required properties:
-- compatible: Should be "st,st21nfca_i2c".
+- compatible: Should be "st,st21nfca-i2c".
 - clock-frequency: I²C work frequency.
 - reg: address on the bus
 - interrupt-parent: phandle for the interrupt gpio controller
@@ -20,7 +20,7 @@ Example (for ARM-based BeagleBoard xM with ST21NFCA on I2C2):
 
 	st21nfca: st21nfca@1 {
 
-		compatible = "st,st21nfca_i2c";
+		compatible = "st,st21nfca-i2c";
 
 		reg = <0x01>;
 		clock-frequency = <400000>;
diff --git a/drivers/nfc/st21nfca/i2c.c b/drivers/nfc/st21nfca/i2c.c
index 0572208..b2e0792 100644
--- a/drivers/nfc/st21nfca/i2c.c
+++ b/drivers/nfc/st21nfca/i2c.c
@@ -661,6 +661,7 @@ static int st21nfca_hci_i2c_remove(struct i2c_client *client)
 
 #ifdef CONFIG_OF
 static const struct of_device_id of_st21nfca_i2c_match[] = {
+	{ .compatible = "st,st21nfca-i2c", },
 	{ .compatible = "st,st21nfca_i2c", },
 	{}
 };
-- 
2.1.0

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [PATCH 02/13] NFC: dts: st21nfcb: Fix compatible string spelling to follow other drivers
       [not found] ` <1422225211-27510-1-git-send-email-christophe-h.ricard-qxv4g6HH51o@public.gmane.org>
  2015-01-25 22:33   ` [PATCH 01/13] NFC: dts: st21nfca: Fix compatible string spelling to follow other drivers Christophe Ricard
@ 2015-01-25 22:33   ` Christophe Ricard
  2015-01-25 22:33   ` [PATCH 03/13] NFC: st21nfcb: Fix "WARNING: invalid free of devm_ allocated data" Christophe Ricard
                     ` (11 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: Christophe Ricard @ 2015-01-25 22:33 UTC (permalink / raw)
  To: sameo-VuQAYsv1563Yd54FQh9/CA
  Cc: linux-nfc-hn68Rpc1hR1g9hUCZPvPmw,
	christophe.ricard-Re5JQEeQqe8AvxtiuMwx3w,
	christophe-h.ricard-qxv4g6HH51o,
	devicetree-u79uwXL29TY76Z2rM5mHXA

Other drivers are following the following compatible string format for dts:
s/_/-/

Because some devices may still use the previous string, the new corrected
string is added to the of_device_id table.

Signed-off-by: Christophe Ricard <christophe-h.ricard-qxv4g6HH51o@public.gmane.org>
---
 Documentation/devicetree/bindings/net/nfc/st21nfcb.txt | 4 ++--
 drivers/nfc/st21nfcb/i2c.c                             | 1 +
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/Documentation/devicetree/bindings/net/nfc/st21nfcb.txt b/Documentation/devicetree/bindings/net/nfc/st21nfcb.txt
index 9005608..bb23707 100644
--- a/Documentation/devicetree/bindings/net/nfc/st21nfcb.txt
+++ b/Documentation/devicetree/bindings/net/nfc/st21nfcb.txt
@@ -1,7 +1,7 @@
 * STMicroelectronics SAS. ST21NFCB NFC Controller
 
 Required properties:
-- compatible: Should be "st,st21nfcb_i2c".
+- compatible: Should be "st,st21nfcb-i2c".
 - clock-frequency: I²C work frequency.
 - reg: address on the bus
 - interrupt-parent: phandle for the interrupt gpio controller
@@ -20,7 +20,7 @@ Example (for ARM-based BeagleBoard xM with ST21NFCB on I2C2):
 
 	st21nfcb: st21nfcb@8 {
 
-		compatible = "st,st21nfcb_i2c";
+		compatible = "st,st21nfcb-i2c";
 
 		reg = <0x08>;
 		clock-frequency = <400000>;
diff --git a/drivers/nfc/st21nfcb/i2c.c b/drivers/nfc/st21nfcb/i2c.c
index 01ba865..b65847c 100644
--- a/drivers/nfc/st21nfcb/i2c.c
+++ b/drivers/nfc/st21nfcb/i2c.c
@@ -373,6 +373,7 @@ static int st21nfcb_nci_i2c_remove(struct i2c_client *client)
 
 #ifdef CONFIG_OF
 static const struct of_device_id of_st21nfcb_i2c_match[] = {
+	{ .compatible = "st,st21nfcb-i2c", },
 	{ .compatible = "st,st21nfcb_i2c", },
 	{}
 };
-- 
2.1.0

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [PATCH 03/13] NFC: st21nfcb: Fix "WARNING: invalid free of devm_ allocated data"
       [not found] ` <1422225211-27510-1-git-send-email-christophe-h.ricard-qxv4g6HH51o@public.gmane.org>
  2015-01-25 22:33   ` [PATCH 01/13] NFC: dts: st21nfca: Fix compatible string spelling to follow other drivers Christophe Ricard
  2015-01-25 22:33   ` [PATCH 02/13] NFC: dts: st21nfcb: " Christophe Ricard
@ 2015-01-25 22:33   ` Christophe Ricard
  2015-01-25 22:33   ` [PATCH 04/13] NFC: st21nfca: Remove unreachable code Christophe Ricard
                     ` (10 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: Christophe Ricard @ 2015-01-25 22:33 UTC (permalink / raw)
  To: sameo-VuQAYsv1563Yd54FQh9/CA
  Cc: linux-nfc-hn68Rpc1hR1g9hUCZPvPmw,
	christophe.ricard-Re5JQEeQqe8AvxtiuMwx3w,
	christophe-h.ricard-qxv4g6HH51o,
	devicetree-u79uwXL29TY76Z2rM5mHXA

ndlc pointer got allocated with devm_kzalloc in ndlc_probe function.

This gives this error message:
drivers/nfc/st21nfcb/ndlc.c:296:1-6: WARNING: invalid free of devm_ allocated data.

Reported-by: Dan Carpenter <dan.carpenter-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org>
Reported-by: Julia Lawall <julia.lawall-L2FTfq7BK8M@public.gmane.org>
Signed-off-by: Christophe Ricard <christophe-h.ricard-qxv4g6HH51o@public.gmane.org>
---
 drivers/nfc/st21nfcb/ndlc.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/nfc/st21nfcb/ndlc.c b/drivers/nfc/st21nfcb/ndlc.c
index bac50e8..ef0f997 100644
--- a/drivers/nfc/st21nfcb/ndlc.c
+++ b/drivers/nfc/st21nfcb/ndlc.c
@@ -297,6 +297,5 @@ void ndlc_remove(struct llt_ndlc *ndlc)
 	skb_queue_purge(&ndlc->send_q);
 
 	st21nfcb_nci_remove(ndlc->ndev);
-	kfree(ndlc);
 }
 EXPORT_SYMBOL(ndlc_remove);
-- 
2.1.0

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [PATCH 04/13] NFC: st21nfca: Remove unreachable code
       [not found] ` <1422225211-27510-1-git-send-email-christophe-h.ricard-qxv4g6HH51o@public.gmane.org>
                     ` (2 preceding siblings ...)
  2015-01-25 22:33   ` [PATCH 03/13] NFC: st21nfcb: Fix "WARNING: invalid free of devm_ allocated data" Christophe Ricard
@ 2015-01-25 22:33   ` Christophe Ricard
  2015-01-25 22:33   ` [PATCH 05/13] NFC: st21nfcb: Avoid use of skb after free Christophe Ricard
                     ` (9 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: Christophe Ricard @ 2015-01-25 22:33 UTC (permalink / raw)
  To: sameo-VuQAYsv1563Yd54FQh9/CA
  Cc: linux-nfc-hn68Rpc1hR1g9hUCZPvPmw,
	christophe.ricard-Re5JQEeQqe8AvxtiuMwx3w,
	christophe-h.ricard-qxv4g6HH51o,
	devicetree-u79uwXL29TY76Z2rM5mHXA

kfree_skb(skb) in st21nfca_hci_event_received is never reach.

Reported-by: Dan Carpenter <dan.carpenter-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org>
Signed-off-by: Christophe Ricard <christophe-h.ricard-qxv4g6HH51o@public.gmane.org>
---
 drivers/nfc/st21nfca/st21nfca.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/nfc/st21nfca/st21nfca.c b/drivers/nfc/st21nfca/st21nfca.c
index f2596c8..880193b 100644
--- a/drivers/nfc/st21nfca/st21nfca.c
+++ b/drivers/nfc/st21nfca/st21nfca.c
@@ -845,8 +845,6 @@ static int st21nfca_hci_event_received(struct nfc_hci_dev *hdev, u8 gate,
 	default:
 		return 1;
 	}
-	kfree_skb(skb);
-	return 0;
 }
 
 static struct nfc_hci_ops st21nfca_hci_ops = {
-- 
2.1.0

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [PATCH 05/13] NFC: st21nfcb: Avoid use of skb after free
       [not found] ` <1422225211-27510-1-git-send-email-christophe-h.ricard-qxv4g6HH51o@public.gmane.org>
                     ` (3 preceding siblings ...)
  2015-01-25 22:33   ` [PATCH 04/13] NFC: st21nfca: Remove unreachable code Christophe Ricard
@ 2015-01-25 22:33   ` Christophe Ricard
  2015-01-25 22:33   ` [PATCH 06/13] NFC: nfc_enable_se Remove useless blank line at beginning of function Christophe Ricard
                     ` (8 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: Christophe Ricard @ 2015-01-25 22:33 UTC (permalink / raw)
  To: sameo-VuQAYsv1563Yd54FQh9/CA
  Cc: linux-nfc-hn68Rpc1hR1g9hUCZPvPmw,
	christophe.ricard-Re5JQEeQqe8AvxtiuMwx3w,
	christophe-h.ricard-qxv4g6HH51o,
	devicetree-u79uwXL29TY76Z2rM5mHXA, Anda-Maria Nicolae

Do not insert in send queue the skb that contains unknown Packet Control
Byte

Acked-by: Christophe Ricard <christophe-h.ricard-qxv4g6HH51o@public.gmane.org>
Signed-off-by: Anda-Maria Nicolae <anda-maria.nicolae-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
---
 drivers/nfc/st21nfcb/ndlc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/nfc/st21nfcb/ndlc.c b/drivers/nfc/st21nfcb/ndlc.c
index ef0f997..5fbf59d 100644
--- a/drivers/nfc/st21nfcb/ndlc.c
+++ b/drivers/nfc/st21nfcb/ndlc.c
@@ -138,7 +138,7 @@ static void llt_ndlc_requeue_data_pending(struct llt_ndlc *ndlc)
 		default:
 			pr_err("UNKNOWN Packet Control Byte=%d\n", pcb);
 			kfree_skb(skb);
-			break;
+			continue;
 		}
 		skb_queue_head(&ndlc->send_q, skb);
 	}
-- 
2.1.0

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [PATCH 06/13] NFC: nfc_enable_se Remove useless blank line at beginning of function
       [not found] ` <1422225211-27510-1-git-send-email-christophe-h.ricard-qxv4g6HH51o@public.gmane.org>
                     ` (4 preceding siblings ...)
  2015-01-25 22:33   ` [PATCH 05/13] NFC: st21nfcb: Avoid use of skb after free Christophe Ricard
@ 2015-01-25 22:33   ` Christophe Ricard
  2015-01-25 22:33   ` [PATCH 07/13] NFC: nfc_disable_se " Christophe Ricard
                     ` (7 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: Christophe Ricard @ 2015-01-25 22:33 UTC (permalink / raw)
  To: sameo-VuQAYsv1563Yd54FQh9/CA
  Cc: linux-nfc-hn68Rpc1hR1g9hUCZPvPmw,
	christophe.ricard-Re5JQEeQqe8AvxtiuMwx3w,
	christophe-h.ricard-qxv4g6HH51o,
	devicetree-u79uwXL29TY76Z2rM5mHXA

Remove one useless blank line at beginning of nfc_enable_se function.

Signed-off-by: Christophe Ricard <christophe-h.ricard-qxv4g6HH51o@public.gmane.org>
---
 net/nfc/core.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/net/nfc/core.c b/net/nfc/core.c
index 819b877..81fabed 100644
--- a/net/nfc/core.c
+++ b/net/nfc/core.c
@@ -555,7 +555,6 @@ EXPORT_SYMBOL(nfc_find_se);
 
 int nfc_enable_se(struct nfc_dev *dev, u32 se_idx)
 {
-
 	struct nfc_se *se;
 	int rc;
 
-- 
2.1.0

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [PATCH 07/13] NFC: nfc_disable_se Remove useless blank line at beginning of function
       [not found] ` <1422225211-27510-1-git-send-email-christophe-h.ricard-qxv4g6HH51o@public.gmane.org>
                     ` (5 preceding siblings ...)
  2015-01-25 22:33   ` [PATCH 06/13] NFC: nfc_enable_se Remove useless blank line at beginning of function Christophe Ricard
@ 2015-01-25 22:33   ` Christophe Ricard
  2015-01-25 22:33   ` [PATCH 08/13] NFC: st21nfca: Remove skb_pipe_list and skb_pipe_info useless allocation Christophe Ricard
                     ` (6 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: Christophe Ricard @ 2015-01-25 22:33 UTC (permalink / raw)
  To: sameo-VuQAYsv1563Yd54FQh9/CA
  Cc: linux-nfc-hn68Rpc1hR1g9hUCZPvPmw,
	christophe.ricard-Re5JQEeQqe8AvxtiuMwx3w,
	christophe-h.ricard-qxv4g6HH51o,
	devicetree-u79uwXL29TY76Z2rM5mHXA

Remove one useless blank line at beginning of nfc_disable_se function.

Signed-off-by: Christophe Ricard <christophe-h.ricard-qxv4g6HH51o@public.gmane.org>
---
 net/nfc/core.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/net/nfc/core.c b/net/nfc/core.c
index 81fabed..7f1b635 100644
--- a/net/nfc/core.c
+++ b/net/nfc/core.c
@@ -604,7 +604,6 @@ error:
 
 int nfc_disable_se(struct nfc_dev *dev, u32 se_idx)
 {
-
 	struct nfc_se *se;
 	int rc;
 
-- 
2.1.0

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [PATCH 08/13] NFC: st21nfca: Remove skb_pipe_list and skb_pipe_info useless allocation
       [not found] ` <1422225211-27510-1-git-send-email-christophe-h.ricard-qxv4g6HH51o@public.gmane.org>
                     ` (6 preceding siblings ...)
  2015-01-25 22:33   ` [PATCH 07/13] NFC: nfc_disable_se " Christophe Ricard
@ 2015-01-25 22:33   ` Christophe Ricard
  2015-01-25 22:33   ` [PATCH 09/13] NFC: st21nfca: Remove checkpatch.pl warning Possible unnecessary 'out of memory' message Christophe Ricard
                     ` (5 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: Christophe Ricard @ 2015-01-25 22:33 UTC (permalink / raw)
  To: sameo-VuQAYsv1563Yd54FQh9/CA
  Cc: linux-nfc-hn68Rpc1hR1g9hUCZPvPmw,
	christophe.ricard-Re5JQEeQqe8AvxtiuMwx3w,
	christophe-h.ricard-qxv4g6HH51o,
	devicetree-u79uwXL29TY76Z2rM5mHXA

skb_pipe_list and skb_pipe_info are allocated in nfc_hci_send_cmd.
alloc_skb on those buffer are then useless.

Signed-off-by: Christophe Ricard <christophe-h.ricard-qxv4g6HH51o@public.gmane.org>
---
 drivers/nfc/st21nfca/st21nfca.c | 13 -------------
 1 file changed, 13 deletions(-)

diff --git a/drivers/nfc/st21nfca/st21nfca.c b/drivers/nfc/st21nfca/st21nfca.c
index 880193b..0667272 100644
--- a/drivers/nfc/st21nfca/st21nfca.c
+++ b/drivers/nfc/st21nfca/st21nfca.c
@@ -118,18 +118,6 @@ static int st21nfca_hci_load_session(struct nfc_hci_dev *hdev)
 		NFC_HCI_TERMINAL_HOST_ID, 0
 	};
 
-	skb_pipe_list = alloc_skb(ST21NFCA_HCI_LLC_MAX_SIZE, GFP_KERNEL);
-	if (!skb_pipe_list) {
-		r = -ENOMEM;
-		goto free_list;
-	}
-
-	skb_pipe_info = alloc_skb(ST21NFCA_HCI_LLC_MAX_SIZE, GFP_KERNEL);
-	if (!skb_pipe_info) {
-		r = -ENOMEM;
-		goto free_info;
-	}
-
 	/* On ST21NFCA device pipes number are dynamics
 	 * A maximum of 16 pipes can be created at the same time
 	 * If pipes are already created, hci_dev_up will fail.
@@ -212,7 +200,6 @@ static int st21nfca_hci_load_session(struct nfc_hci_dev *hdev)
 	memcpy(hdev->init_data.gates, st21nfca_gates, sizeof(st21nfca_gates));
 free_info:
 	kfree_skb(skb_pipe_info);
-free_list:
 	kfree_skb(skb_pipe_list);
 	return r;
 }
-- 
2.1.0

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [PATCH 09/13] NFC: st21nfca: Remove checkpatch.pl warning Possible unnecessary 'out of memory' message
       [not found] ` <1422225211-27510-1-git-send-email-christophe-h.ricard-qxv4g6HH51o@public.gmane.org>
                     ` (7 preceding siblings ...)
  2015-01-25 22:33   ` [PATCH 08/13] NFC: st21nfca: Remove skb_pipe_list and skb_pipe_info useless allocation Christophe Ricard
@ 2015-01-25 22:33   ` Christophe Ricard
  2015-01-25 22:33   ` [PATCH 10/13] NFC: st21nfca: Fix some skb memory leaks Christophe Ricard
                     ` (4 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: Christophe Ricard @ 2015-01-25 22:33 UTC (permalink / raw)
  To: sameo-VuQAYsv1563Yd54FQh9/CA
  Cc: linux-nfc-hn68Rpc1hR1g9hUCZPvPmw,
	christophe.ricard-Re5JQEeQqe8AvxtiuMwx3w,
	christophe-h.ricard-qxv4g6HH51o,
	devicetree-u79uwXL29TY76Z2rM5mHXA

Remove unnecessary memory allocation message already shown by devm_kzalloc.
This remove a warning when running scripts/checkpatch.

Signed-off-by: Christophe Ricard <christophe-h.ricard-qxv4g6HH51o@public.gmane.org>
---
 drivers/nfc/st21nfca/i2c.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/drivers/nfc/st21nfca/i2c.c b/drivers/nfc/st21nfca/i2c.c
index b2e0792..82b82db 100644
--- a/drivers/nfc/st21nfca/i2c.c
+++ b/drivers/nfc/st21nfca/i2c.c
@@ -591,11 +591,8 @@ static int st21nfca_hci_i2c_probe(struct i2c_client *client,
 
 	phy = devm_kzalloc(&client->dev, sizeof(struct st21nfca_i2c_phy),
 			   GFP_KERNEL);
-	if (!phy) {
-		nfc_err(&client->dev,
-			"Cannot allocate memory for st21nfca i2c phy.\n");
+	if (!phy)
 		return -ENOMEM;
-	}
 
 	phy->i2c_dev = client;
 	phy->pending_skb = alloc_skb(ST21NFCA_HCI_LLC_MAX_SIZE * 2, GFP_KERNEL);
-- 
2.1.0

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [PATCH 10/13] NFC: st21nfca: Fix some skb memory leaks
       [not found] ` <1422225211-27510-1-git-send-email-christophe-h.ricard-qxv4g6HH51o@public.gmane.org>
                     ` (8 preceding siblings ...)
  2015-01-25 22:33   ` [PATCH 09/13] NFC: st21nfca: Remove checkpatch.pl warning Possible unnecessary 'out of memory' message Christophe Ricard
@ 2015-01-25 22:33   ` Christophe Ricard
  2015-01-25 22:33   ` [PATCH 11/13] NFC: st21nfcb: Fix "NULL pointer dereference" possible error Christophe Ricard
                     ` (3 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: Christophe Ricard @ 2015-01-25 22:33 UTC (permalink / raw)
  To: sameo-VuQAYsv1563Yd54FQh9/CA
  Cc: linux-nfc-hn68Rpc1hR1g9hUCZPvPmw,
	christophe.ricard-Re5JQEeQqe8AvxtiuMwx3w,
	christophe-h.ricard-qxv4g6HH51o,
	devicetree-u79uwXL29TY76Z2rM5mHXA

Fix some memory leaks after some nfc_hci_get_param calls.

Signed-off-by: Christophe Ricard <christophe-h.ricard-qxv4g6HH51o@public.gmane.org>
---
 drivers/nfc/st21nfca/st21nfca.c | 37 +++++++++++++++++++++----------------
 1 file changed, 21 insertions(+), 16 deletions(-)

diff --git a/drivers/nfc/st21nfca/st21nfca.c b/drivers/nfc/st21nfca/st21nfca.c
index 0667272..7cb7ce4 100644
--- a/drivers/nfc/st21nfca/st21nfca.c
+++ b/drivers/nfc/st21nfca/st21nfca.c
@@ -261,8 +261,9 @@ static int st21nfca_hci_ready(struct nfc_hci_dev *hdev)
 	if (r < 0)
 		return r;
 
-	if (skb->data[0] == 0) {
-		kfree_skb(skb);
+	param = skb->data[0];
+	kfree_skb(skb);
+	if (param == 0) {
 		param = 1;
 
 		r = nfc_hci_set_param(hdev, ST21NFCA_DEVICE_MGNT_GATE,
@@ -404,9 +405,12 @@ static int st21nfca_hci_start_poll(struct nfc_hci_dev *hdev,
 			r = nfc_hci_set_param(hdev, ST21NFCA_RF_CARD_F_GATE,
 					      ST21NFCA_RF_CARD_F_DATARATE,
 					      param, 1);
-			if (r < 0)
+			if (r < 0) {
+				kfree_skb(datarate_skb);
 				return r;
+			}
 		}
+		kfree_skb(datarate_skb);
 
 		/*
 		 * Configure sens_res
@@ -660,15 +664,15 @@ static int st21nfca_hci_complete_target_discovered(struct nfc_hci_dev *hdev,
 						struct nfc_target *target)
 {
 	int r;
-	struct sk_buff *nfcid2_skb = NULL, *nfcid1_skb;
+	struct sk_buff *nfcid_skb = NULL;
 
 	if (gate == ST21NFCA_RF_READER_F_GATE) {
 		r = nfc_hci_get_param(hdev, ST21NFCA_RF_READER_F_GATE,
-				ST21NFCA_RF_READER_F_NFCID2, &nfcid2_skb);
+				ST21NFCA_RF_READER_F_NFCID2, &nfcid_skb);
 		if (r < 0)
 			goto exit;
 
-		if (nfcid2_skb->len > NFC_SENSF_RES_MAXSIZE) {
+		if (nfcid_skb->len > NFC_SENSF_RES_MAXSIZE) {
 			r = -EPROTO;
 			goto exit;
 		}
@@ -680,11 +684,11 @@ static int st21nfca_hci_complete_target_discovered(struct nfc_hci_dev *hdev,
 		 * - After the reception of SEL_RES with NFCIP-1 compliant bit
 		 * set for type A frame NFCID1 will be updated
 		 */
-		if (nfcid2_skb->len > 0) {
+		if (nfcid_skb->len > 0) {
 			/* P2P in type F */
-			memcpy(target->sensf_res, nfcid2_skb->data,
-				nfcid2_skb->len);
-			target->sensf_res_len = nfcid2_skb->len;
+			memcpy(target->sensf_res, nfcid_skb->data,
+				nfcid_skb->len);
+			target->sensf_res_len = nfcid_skb->len;
 			/* NFC Forum Digital Protocol Table 44 */
 			if (target->sensf_res[0] == 0x01 &&
 			    target->sensf_res[1] == 0xfe)
@@ -694,27 +698,28 @@ static int st21nfca_hci_complete_target_discovered(struct nfc_hci_dev *hdev,
 				target->supported_protocols =
 							NFC_PROTO_FELICA_MASK;
 		} else {
+			kfree_skb(nfcid_skb);
 			/* P2P in type A */
 			r = nfc_hci_get_param(hdev, ST21NFCA_RF_READER_F_GATE,
 					ST21NFCA_RF_READER_F_NFCID1,
-					&nfcid1_skb);
+					&nfcid_skb);
 			if (r < 0)
 				goto exit;
 
-			if (nfcid1_skb->len > NFC_NFCID1_MAXSIZE) {
+			if (nfcid_skb->len > NFC_NFCID1_MAXSIZE) {
 				r = -EPROTO;
 				goto exit;
 			}
-			memcpy(target->sensf_res, nfcid1_skb->data,
-				nfcid1_skb->len);
-			target->sensf_res_len = nfcid1_skb->len;
+			memcpy(target->sensf_res, nfcid_skb->data,
+				nfcid_skb->len);
+			target->sensf_res_len = nfcid_skb->len;
 			target->supported_protocols = NFC_PROTO_NFC_DEP_MASK;
 		}
 		target->hci_reader_gate = ST21NFCA_RF_READER_F_GATE;
 	}
 	r = 1;
 exit:
-	kfree_skb(nfcid2_skb);
+	kfree_skb(nfcid_skb);
 	return r;
 }
 
-- 
2.1.0

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [PATCH 11/13] NFC: st21nfcb: Fix "NULL pointer dereference" possible error
       [not found] ` <1422225211-27510-1-git-send-email-christophe-h.ricard-qxv4g6HH51o@public.gmane.org>
                     ` (9 preceding siblings ...)
  2015-01-25 22:33   ` [PATCH 10/13] NFC: st21nfca: Fix some skb memory leaks Christophe Ricard
@ 2015-01-25 22:33   ` Christophe Ricard
  2015-01-25 22:33   ` [PATCH 12/13] NFC: st21nfcb: Remove useless include Christophe Ricard
                     ` (2 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: Christophe Ricard @ 2015-01-25 22:33 UTC (permalink / raw)
  To: sameo-VuQAYsv1563Yd54FQh9/CA
  Cc: linux-nfc-hn68Rpc1hR1g9hUCZPvPmw,
	christophe.ricard-Re5JQEeQqe8AvxtiuMwx3w,
	christophe-h.ricard-qxv4g6HH51o,
	devicetree-u79uwXL29TY76Z2rM5mHXA

When the platform with CONFIG_ST21NFCB_I2C=y without any st21nfcb component
physically connected a:
"Unable to handle kernel NULL pointer dereference at virtual address" may
show up at driver initialization phase.

Signed-off-by: Christophe Ricard <christophe-h.ricard-qxv4g6HH51o@public.gmane.org>
---
 drivers/nfc/st21nfcb/i2c.c | 18 +++++++++++-------
 1 file changed, 11 insertions(+), 7 deletions(-)

diff --git a/drivers/nfc/st21nfcb/i2c.c b/drivers/nfc/st21nfcb/i2c.c
index b65847c..eb88693 100644
--- a/drivers/nfc/st21nfcb/i2c.c
+++ b/drivers/nfc/st21nfcb/i2c.c
@@ -199,7 +199,7 @@ static irqreturn_t st21nfcb_nci_irq_thread_fn(int irq, void *phy_id)
 	struct sk_buff *skb = NULL;
 	int r;
 
-	if (!phy || irq != phy->i2c_dev->irq) {
+	if (!phy || !phy->ndlc || irq != phy->i2c_dev->irq) {
 		WARN_ON_ONCE(1);
 		return IRQ_NONE;
 	}
@@ -343,18 +343,22 @@ static int st21nfcb_nci_i2c_probe(struct i2c_client *client,
 		return -ENODEV;
 	}
 
+	r = ndlc_probe(phy, &i2c_phy_ops, &client->dev,
+			ST21NFCB_FRAME_HEADROOM, ST21NFCB_FRAME_TAILROOM,
+			&phy->ndlc);
+	if (r < 0) {
+		nfc_err(&client->dev, "Unable to register ndlc layer\n");
+		return r;
+	}
+
 	r = devm_request_threaded_irq(&client->dev, client->irq, NULL,
 				st21nfcb_nci_irq_thread_fn,
 				phy->irq_polarity | IRQF_ONESHOT,
 				ST21NFCB_NCI_DRIVER_NAME, phy);
-	if (r < 0) {
+	if (r < 0)
 		nfc_err(&client->dev, "Unable to register IRQ handler\n");
-		return r;
-	}
 
-	return ndlc_probe(phy, &i2c_phy_ops, &client->dev,
-			ST21NFCB_FRAME_HEADROOM, ST21NFCB_FRAME_TAILROOM,
-			&phy->ndlc);
+	return r;
 }
 
 static int st21nfcb_nci_i2c_remove(struct i2c_client *client)
-- 
2.1.0

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [PATCH 12/13] NFC: st21nfcb: Remove useless include
       [not found] ` <1422225211-27510-1-git-send-email-christophe-h.ricard-qxv4g6HH51o@public.gmane.org>
                     ` (10 preceding siblings ...)
  2015-01-25 22:33   ` [PATCH 11/13] NFC: st21nfcb: Fix "NULL pointer dereference" possible error Christophe Ricard
@ 2015-01-25 22:33   ` Christophe Ricard
  2015-01-25 22:33   ` [PATCH 13/13] NFC: st21nfcb: Fix copy/paste error in comment Christophe Ricard
  2015-01-26 23:57   ` [PATCH 00/13] 3.19 st21nfc fixes Samuel Ortiz
  13 siblings, 0 replies; 15+ messages in thread
From: Christophe Ricard @ 2015-01-25 22:33 UTC (permalink / raw)
  To: sameo-VuQAYsv1563Yd54FQh9/CA
  Cc: linux-nfc-hn68Rpc1hR1g9hUCZPvPmw,
	christophe.ricard-Re5JQEeQqe8AvxtiuMwx3w,
	christophe-h.ricard-qxv4g6HH51o,
	devicetree-u79uwXL29TY76Z2rM5mHXA

include/linux/platform_data/st21nfcb.h is phy generic.
There is no need to include linux/i2c.h

Signed-off-by: Christophe Ricard <christophe-h.ricard-qxv4g6HH51o@public.gmane.org>
---
 include/linux/platform_data/st21nfcb.h | 2 --
 1 file changed, 2 deletions(-)

diff --git a/include/linux/platform_data/st21nfcb.h b/include/linux/platform_data/st21nfcb.h
index c3b432f..05c54c9 100644
--- a/include/linux/platform_data/st21nfcb.h
+++ b/include/linux/platform_data/st21nfcb.h
@@ -19,8 +19,6 @@
 #ifndef _ST21NFCB_NCI_H_
 #define _ST21NFCB_NCI_H_
 
-#include <linux/i2c.h>
-
 #define ST21NFCB_NCI_DRIVER_NAME "st21nfcb_nci"
 
 struct st21nfcb_nfc_platform_data {
-- 
2.1.0

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [PATCH 13/13] NFC: st21nfcb: Fix copy/paste error in comment
       [not found] ` <1422225211-27510-1-git-send-email-christophe-h.ricard-qxv4g6HH51o@public.gmane.org>
                     ` (11 preceding siblings ...)
  2015-01-25 22:33   ` [PATCH 12/13] NFC: st21nfcb: Remove useless include Christophe Ricard
@ 2015-01-25 22:33   ` Christophe Ricard
  2015-01-26 23:57   ` [PATCH 00/13] 3.19 st21nfc fixes Samuel Ortiz
  13 siblings, 0 replies; 15+ messages in thread
From: Christophe Ricard @ 2015-01-25 22:33 UTC (permalink / raw)
  To: sameo-VuQAYsv1563Yd54FQh9/CA
  Cc: linux-nfc-hn68Rpc1hR1g9hUCZPvPmw,
	christophe.ricard-Re5JQEeQqe8AvxtiuMwx3w,
	christophe-h.ricard-qxv4g6HH51o,
	devicetree-u79uwXL29TY76Z2rM5mHXA

include/linux/platform_data/st21nfcb.h is based on
include/linux/platform_data/st21nfca.h.

The endif comment is inacurrate for st21nfcb.

Signed-off-by: Christophe Ricard <christophe-h.ricard-qxv4g6HH51o@public.gmane.org>
---
 include/linux/platform_data/st21nfcb.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/linux/platform_data/st21nfcb.h b/include/linux/platform_data/st21nfcb.h
index 05c54c9..b023373 100644
--- a/include/linux/platform_data/st21nfcb.h
+++ b/include/linux/platform_data/st21nfcb.h
@@ -26,4 +26,4 @@ struct st21nfcb_nfc_platform_data {
 	unsigned int irq_polarity;
 };
 
-#endif /* _ST21NFCA_HCI_H_ */
+#endif /* _ST21NFCB_NCI_H_ */
-- 
2.1.0

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply related	[flat|nested] 15+ messages in thread

* Re: [PATCH 00/13] 3.19 st21nfc fixes
       [not found] ` <1422225211-27510-1-git-send-email-christophe-h.ricard-qxv4g6HH51o@public.gmane.org>
                     ` (12 preceding siblings ...)
  2015-01-25 22:33   ` [PATCH 13/13] NFC: st21nfcb: Fix copy/paste error in comment Christophe Ricard
@ 2015-01-26 23:57   ` Samuel Ortiz
  13 siblings, 0 replies; 15+ messages in thread
From: Samuel Ortiz @ 2015-01-26 23:57 UTC (permalink / raw)
  To: Christophe Ricard
  Cc: linux-nfc-hn68Rpc1hR1g9hUCZPvPmw, christophe-h.ricard-qxv4g6HH51o,
	devicetree-u79uwXL29TY76Z2rM5mHXA

On Sun, Jan 25, 2015 at 11:33:18PM +0100, Christophe Ricard wrote:
> Christophe Ricard (13):
>   NFC: dts: st21nfca: Fix compatible string spelling to follow other
>     drivers
>   NFC: dts: st21nfcb: Fix compatible string spelling to follow other
>     drivers
>   NFC: st21nfcb: Fix "WARNING: invalid free of devm_ allocated data"
>   NFC: st21nfca: Remove unreachable code
>   NFC: st21nfcb: Avoid use of skb after free
>   NFC: nfc_enable_se Remove useless blank line at beginning of function
>   NFC: nfc_disable_se Remove useless blank line at beginning of function
>   NFC: st21nfca: Remove skb_pipe_list and skb_pipe_info useless
>     allocation
>   NFC: st21nfca: Remove checkpatch.pl warning Possible unnecessary 'out
>     of memory' message
>   NFC: st21nfca: Fix some skb memory leaks
>   NFC: st21nfcb: Fix "NULL pointer dereference" possible error
>   NFC: st21nfcb: Remove useless include
>   NFC: st21nfcb: Fix copy/paste error in comment
All 13 patches applied to nfc-next, many thanks.

Cheers,
Samuel.
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2015-01-26 23:57 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-01-25 22:33 [PATCH 00/13] 3.19 st21nfc fixes Christophe Ricard
     [not found] ` <1422225211-27510-1-git-send-email-christophe-h.ricard-qxv4g6HH51o@public.gmane.org>
2015-01-25 22:33   ` [PATCH 01/13] NFC: dts: st21nfca: Fix compatible string spelling to follow other drivers Christophe Ricard
2015-01-25 22:33   ` [PATCH 02/13] NFC: dts: st21nfcb: " Christophe Ricard
2015-01-25 22:33   ` [PATCH 03/13] NFC: st21nfcb: Fix "WARNING: invalid free of devm_ allocated data" Christophe Ricard
2015-01-25 22:33   ` [PATCH 04/13] NFC: st21nfca: Remove unreachable code Christophe Ricard
2015-01-25 22:33   ` [PATCH 05/13] NFC: st21nfcb: Avoid use of skb after free Christophe Ricard
2015-01-25 22:33   ` [PATCH 06/13] NFC: nfc_enable_se Remove useless blank line at beginning of function Christophe Ricard
2015-01-25 22:33   ` [PATCH 07/13] NFC: nfc_disable_se " Christophe Ricard
2015-01-25 22:33   ` [PATCH 08/13] NFC: st21nfca: Remove skb_pipe_list and skb_pipe_info useless allocation Christophe Ricard
2015-01-25 22:33   ` [PATCH 09/13] NFC: st21nfca: Remove checkpatch.pl warning Possible unnecessary 'out of memory' message Christophe Ricard
2015-01-25 22:33   ` [PATCH 10/13] NFC: st21nfca: Fix some skb memory leaks Christophe Ricard
2015-01-25 22:33   ` [PATCH 11/13] NFC: st21nfcb: Fix "NULL pointer dereference" possible error Christophe Ricard
2015-01-25 22:33   ` [PATCH 12/13] NFC: st21nfcb: Remove useless include Christophe Ricard
2015-01-25 22:33   ` [PATCH 13/13] NFC: st21nfcb: Fix copy/paste error in comment Christophe Ricard
2015-01-26 23:57   ` [PATCH 00/13] 3.19 st21nfc fixes Samuel Ortiz

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).