All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Bluetooth: do not use assignment in if condition
@ 2010-11-22 11:21 Emeltchenko Andrei
  2010-11-22 13:24 ` Ville Tervo
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Emeltchenko Andrei @ 2010-11-22 11:21 UTC (permalink / raw)
  To: linux-bluetooth

From: Andrei Emeltchenko <andrei.emeltchenko@nokia.com>

Fix checkpatch errors like:
"ERROR: do not use assignment in if condition"
Simplify code and fix one long line.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@nokia.com>
---
 net/bluetooth/hci_event.c |   18 ++++++++++++------
 1 files changed, 12 insertions(+), 6 deletions(-)

diff --git a/net/bluetooth/hci_event.c b/net/bluetooth/hci_event.c
index 4165895..3c1957c 100644
--- a/net/bluetooth/hci_event.c
+++ b/net/bluetooth/hci_event.c
@@ -996,12 +996,14 @@ static inline void hci_conn_request_evt(struct hci_dev *hdev, struct sk_buff *sk
 
 		hci_dev_lock(hdev);
 
-		if ((ie = hci_inquiry_cache_lookup(hdev, &ev->bdaddr)))
+		ie = hci_inquiry_cache_lookup(hdev, &ev->bdaddr);
+		if (ie)
 			memcpy(ie->data.dev_class, ev->dev_class, 3);
 
 		conn = hci_conn_hash_lookup_ba(hdev, ev->link_type, &ev->bdaddr);
 		if (!conn) {
-			if (!(conn = hci_conn_add(hdev, ev->link_type, &ev->bdaddr))) {
+			conn = hci_conn_add(hdev, ev->link_type, &ev->bdaddr);
+			if (!conn) {
 				BT_ERR("No memory for new connection");
 				hci_dev_unlock(hdev);
 				return;
@@ -1608,7 +1610,8 @@ static inline void hci_clock_offset_evt(struct hci_dev *hdev, struct sk_buff *sk
 	if (conn && !ev->status) {
 		struct inquiry_entry *ie;
 
-		if ((ie = hci_inquiry_cache_lookup(hdev, &conn->dst))) {
+		ie = hci_inquiry_cache_lookup(hdev, &conn->dst);
+		if (ie) {
 			ie->data.clock_offset = ev->clock_offset;
 			ie->timestamp = jiffies;
 		}
@@ -1642,7 +1645,8 @@ static inline void hci_pscan_rep_mode_evt(struct hci_dev *hdev, struct sk_buff *
 
 	hci_dev_lock(hdev);
 
-	if ((ie = hci_inquiry_cache_lookup(hdev, &ev->bdaddr))) {
+	ie = hci_inquiry_cache_lookup(hdev, &ev->bdaddr);
+	if (ie) {
 		ie->data.pscan_rep_mode = ev->pscan_rep_mode;
 		ie->timestamp = jiffies;
 	}
@@ -1713,7 +1717,8 @@ static inline void hci_remote_ext_features_evt(struct hci_dev *hdev, struct sk_b
 	if (!ev->status && ev->page == 0x01) {
 		struct inquiry_entry *ie;
 
-		if ((ie = hci_inquiry_cache_lookup(hdev, &conn->dst)))
+		ie = hci_inquiry_cache_lookup(hdev, &conn->dst);
+		if (ie)
 			ie->data.ssp_mode = (ev->features[0] & 0x01);
 
 		conn->ssp_mode = (ev->features[0] & 0x01);
@@ -1886,7 +1891,8 @@ static inline void hci_remote_host_features_evt(struct hci_dev *hdev, struct sk_
 
 	hci_dev_lock(hdev);
 
-	if ((ie = hci_inquiry_cache_lookup(hdev, &ev->bdaddr)))
+	ie = hci_inquiry_cache_lookup(hdev, &ev->bdaddr);
+	if (ie)
 		ie->data.ssp_mode = (ev->features[0] & 0x01);
 
 	hci_dev_unlock(hdev);
-- 
1.7.1


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

* Re: [PATCH] Bluetooth: do not use assignment in if condition
  2010-11-22 11:21 [PATCH] Bluetooth: do not use assignment in if condition Emeltchenko Andrei
@ 2010-11-22 13:24 ` Ville Tervo
  2010-11-22 17:40 ` Gustavo F. Padovan
  2010-11-24 12:40 ` Marcel Holtmann
  2 siblings, 0 replies; 4+ messages in thread
From: Ville Tervo @ 2010-11-22 13:24 UTC (permalink / raw)
  To: ext Emeltchenko Andrei; +Cc: linux-bluetooth

Hi Andrei,

On Mon, Nov 22, 2010 at 01:21:37PM +0200, ext Emeltchenko Andrei wrote:
> From: Andrei Emeltchenko <andrei.emeltchenko@nokia.com>
> 
> Fix checkpatch errors like:
> "ERROR: do not use assignment in if condition"
> Simplify code and fix one long line.
> 
> Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@nokia.com>

Looks good to me

Acked-by: Ville Tervo <ville.tervo@nokia.com>


> ---
>  net/bluetooth/hci_event.c |   18 ++++++++++++------
>  1 files changed, 12 insertions(+), 6 deletions(-)
> 
> diff --git a/net/bluetooth/hci_event.c b/net/bluetooth/hci_event.c
> index 4165895..3c1957c 100644
> --- a/net/bluetooth/hci_event.c
> +++ b/net/bluetooth/hci_event.c
> @@ -996,12 +996,14 @@ static inline void hci_conn_request_evt(struct hci_dev *hdev, struct sk_buff *sk
>  
>  		hci_dev_lock(hdev);
>  
> -		if ((ie = hci_inquiry_cache_lookup(hdev, &ev->bdaddr)))
> +		ie = hci_inquiry_cache_lookup(hdev, &ev->bdaddr);
> +		if (ie)
>  			memcpy(ie->data.dev_class, ev->dev_class, 3);
>  
>  		conn = hci_conn_hash_lookup_ba(hdev, ev->link_type, &ev->bdaddr);
>  		if (!conn) {
> -			if (!(conn = hci_conn_add(hdev, ev->link_type, &ev->bdaddr))) {
> +			conn = hci_conn_add(hdev, ev->link_type, &ev->bdaddr);
> +			if (!conn) {
>  				BT_ERR("No memory for new connection");
>  				hci_dev_unlock(hdev);
>  				return;
> @@ -1608,7 +1610,8 @@ static inline void hci_clock_offset_evt(struct hci_dev *hdev, struct sk_buff *sk
>  	if (conn && !ev->status) {
>  		struct inquiry_entry *ie;
>  
> -		if ((ie = hci_inquiry_cache_lookup(hdev, &conn->dst))) {
> +		ie = hci_inquiry_cache_lookup(hdev, &conn->dst);
> +		if (ie) {
>  			ie->data.clock_offset = ev->clock_offset;
>  			ie->timestamp = jiffies;
>  		}
> @@ -1642,7 +1645,8 @@ static inline void hci_pscan_rep_mode_evt(struct hci_dev *hdev, struct sk_buff *
>  
>  	hci_dev_lock(hdev);
>  
> -	if ((ie = hci_inquiry_cache_lookup(hdev, &ev->bdaddr))) {
> +	ie = hci_inquiry_cache_lookup(hdev, &ev->bdaddr);
> +	if (ie) {
>  		ie->data.pscan_rep_mode = ev->pscan_rep_mode;
>  		ie->timestamp = jiffies;
>  	}
> @@ -1713,7 +1717,8 @@ static inline void hci_remote_ext_features_evt(struct hci_dev *hdev, struct sk_b
>  	if (!ev->status && ev->page == 0x01) {
>  		struct inquiry_entry *ie;
>  
> -		if ((ie = hci_inquiry_cache_lookup(hdev, &conn->dst)))
> +		ie = hci_inquiry_cache_lookup(hdev, &conn->dst);
> +		if (ie)
>  			ie->data.ssp_mode = (ev->features[0] & 0x01);
>  
>  		conn->ssp_mode = (ev->features[0] & 0x01);
> @@ -1886,7 +1891,8 @@ static inline void hci_remote_host_features_evt(struct hci_dev *hdev, struct sk_
>  
>  	hci_dev_lock(hdev);
>  
> -	if ((ie = hci_inquiry_cache_lookup(hdev, &ev->bdaddr)))
> +	ie = hci_inquiry_cache_lookup(hdev, &ev->bdaddr);
> +	if (ie)
>  		ie->data.ssp_mode = (ev->features[0] & 0x01);
>  
>  	hci_dev_unlock(hdev);
> -- 
> 1.7.1
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-bluetooth" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: [PATCH] Bluetooth: do not use assignment in if condition
  2010-11-22 11:21 [PATCH] Bluetooth: do not use assignment in if condition Emeltchenko Andrei
  2010-11-22 13:24 ` Ville Tervo
@ 2010-11-22 17:40 ` Gustavo F. Padovan
  2010-11-24 12:40 ` Marcel Holtmann
  2 siblings, 0 replies; 4+ messages in thread
From: Gustavo F. Padovan @ 2010-11-22 17:40 UTC (permalink / raw)
  To: Emeltchenko Andrei; +Cc: linux-bluetooth

Hi Andrei,

* Emeltchenko Andrei <Andrei.Emeltchenko.news@gmail.com> [2010-11-22 13:21:37 +0200]:

> From: Andrei Emeltchenko <andrei.emeltchenko@nokia.com>
> 
> Fix checkpatch errors like:
> "ERROR: do not use assignment in if condition"
> Simplify code and fix one long line.
> 
> Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@nokia.com>
> ---
>  net/bluetooth/hci_event.c |   18 ++++++++++++------
>  1 files changed, 12 insertions(+), 6 deletions(-)

Applied, thanks.

-- 
Gustavo F. Padovan
http://profusion.mobi

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

* Re: [PATCH] Bluetooth: do not use assignment in if condition
  2010-11-22 11:21 [PATCH] Bluetooth: do not use assignment in if condition Emeltchenko Andrei
  2010-11-22 13:24 ` Ville Tervo
  2010-11-22 17:40 ` Gustavo F. Padovan
@ 2010-11-24 12:40 ` Marcel Holtmann
  2 siblings, 0 replies; 4+ messages in thread
From: Marcel Holtmann @ 2010-11-24 12:40 UTC (permalink / raw)
  To: Emeltchenko Andrei; +Cc: linux-bluetooth

Hi Andrei,

> Fix checkpatch errors like:
> "ERROR: do not use assignment in if condition"
> Simplify code and fix one long line.
> 
> Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@nokia.com>
> ---
>  net/bluetooth/hci_event.c |   18 ++++++++++++------
>  1 files changed, 12 insertions(+), 6 deletions(-)

I am fine with these. It is just pretty old code and it is good that you
start fixing these up.

Acked-by: Marcel Holtmann <marcel@holtmann.org>

Regards

Marcel



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

end of thread, other threads:[~2010-11-24 12:40 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-11-22 11:21 [PATCH] Bluetooth: do not use assignment in if condition Emeltchenko Andrei
2010-11-22 13:24 ` Ville Tervo
2010-11-22 17:40 ` Gustavo F. Padovan
2010-11-24 12:40 ` Marcel Holtmann

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.