Skip to contentSkip to conversation

Fix gcc 4.6.0 set but unused variable warnings

PATCH In review Justin P. Mattock 6 participants 38 messages Jun 27, 2010 – Jul 2, 2010

Subsystems (6)
lore
Share & tools
lore
#29 lore raw

PATCH 5/5 bluetooth:hci_bcsp Fix operation on 'bcsp->msgq_txseq' may be undefined

In reply to Justin P. Mattock

Im seeing this building the kernel with gcc 4.6.0
CC [M] drivers/bluetooth/hci_bcsp.o
drivers/bluetooth/hci_bcsp.c: In function 'bcsp_prepare_pkt':
drivers/bluetooth/hci_bcsp.c:247:20: warning: operation on 'bcsp->msgq_txseq' may be undefined

Hopefully the below is a fix for this. Please let me know.

---
 drivers/bluetooth/hci_bcsp.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)
drivers/bluetooth/hci_bcsp.c +3 -3
index 40aec0f..0f892e7 100644
@@ -182,7 +182,7 @@ static struct sk_buff *bcsp_prepare_pkt(struct bcsp_struct *bcsp, u8 *data,
 	struct sk_buff *nskb;
 	u8 hdr[4], chan;
 	u16 BCSP_CRC_INIT(bcsp_txmsg_crc);
-	int rel, i;
+	int rel, i, ret;
 
 	switch (pkt_type) {
 	case HCI_ACLDATA_PKT:
@@ -243,8 +243,8 @@ static struct sk_buff *bcsp_prepare_pkt(struct bcsp_struct *bcsp, u8 *data,
 
 	if (rel) {
 		hdr[0] |= 0x80 + bcsp->msgq_txseq;
-		BT_DBG("Sending packet with seqno %u", bcsp->msgq_txseq);
-		bcsp->msgq_txseq = ++(bcsp->msgq_txseq) & 0x07;
+		BT_DBG("Sending packet with seqno %u", bcsp->msgq_txseq | ret);
+		ret = ++(bcsp->msgq_txseq) & 0x07;
 	}
 
 	if (bcsp->use_crc)
Signature · 1 line
1.7.1.rc1.21.gf3bd6
#0 lore raw

cover Fix gcc 4.6.0 set but unused variable warnings

This set of patches fixes some warning messages generated by gcc 4.6.0. Please have a look at these if/when you have the time, and let me know what might be changed etc..

cheers,

Justin P. Mattock

#1 lore raw

PATCH 1/5 security:key.c Fix warning: variable 'key' set but not used

building with gcc 4.6 I'm getting a warning message:
CC security/keys/keyctl.o
security/keys/keyctl.c: In function 'keyctl_describe_key':
security/keys/keyctl.c:472:14: warning: variable 'key' set but not used

After reading key.h I noticed it says this:
NOTE! key_ref_t is a typedef'd pointer to a type that is not actually defined. This is because we abuse the bottom bit of the reference to carry a flag to indicate whether the calling process possesses that key in one of its keyrings.

In this case the safest approach(in my mind) would be to just mark the integer __unused. Keep in mind though Im not certain if this is the right place for this value i.e. will this effect *instkey or not(please check).

---
 security/keys/keyctl.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
security/keys/keyctl.c +1 -1
index 13074b4..d7bb74f 100644
@@ -469,7 +469,7 @@ long keyctl_describe_key(key_serial_t keyid,
 			 char __user *buffer,
 			 size_t buflen)
 {
-	struct key *key, *instkey;
+	struct key *key __attribute__((unused)), *instkey;
 	key_ref_t key_ref;
 	char *tmpbuf;
 	long ret;
Signature · 1 line
1.7.1.rc1.21.gf3bd6
#6 lore raw

PATCH 2/5 security:ebitmap.c Fix warning: variable 'e_sft' set but not used

In reply to Justin P. Mattock

gcc is giving me this during compiling:
CC security/selinux/ss/ebitmap.o
security/selinux/ss/ebitmap.c: In function 'ebitmap_netlbl_import':
security/selinux/ss/ebitmap.c:159:27: warning: variable 'e_sft' set but not used

The below fixes this warning for me.
(please check this whenever you have time).

---
 security/selinux/ss/ebitmap.c |    3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)
security/selinux/ss/ebitmap.c +1 -2
index 04b6145..b7980ee 100644
@@ -156,7 +156,7 @@ int ebitmap_netlbl_import(struct ebitmap *ebmap,
 	struct ebitmap_node *e_iter = NULL;
 	struct ebitmap_node *emap_prev = NULL;
 	struct netlbl_lsm_secattr_catmap *c_iter = catmap;
-	u32 c_idx, c_pos, e_idx, e_sft;
+	u32 c_idx, c_pos, e_idx;
 
 	/* NetLabel's NETLBL_CATMAP_MAPTYPE is defined as an array of u64,
 	 * however, it is not always compatible with an array of unsigned long
@@ -190,7 +190,6 @@ int ebitmap_netlbl_import(struct ebitmap *ebmap,
 			}
 			delta = c_pos - e_iter->startbit;
 			e_idx = delta / EBITMAP_UNIT_SIZE;
-			e_sft = delta % EBITMAP_UNIT_SIZE;
 			while (map) {
 				e_iter->maps[e_idx++] |= map & (-1UL);
 				map = EBITMAP_SHIFT_UNIT_SIZE(map);
Signature · 1 line
1.7.1.rc1.21.gf3bd6
#9 lore raw

PATCH 3/5 acpi:glue.c Fix warning: variable 'ret' set but not used

In reply to Justin P. Mattock

Im getting a warning message when building with gcc 4.6.0
CC drivers/acpi/glue.o
drivers/acpi/glue.c: In function 'acpi_bind_one':
drivers/acpi/glue.c:163:7: warning: variable 'ret' set but not used

The below fixes it for me. Please have a look when you have time and let me know(bit confused with the backwardness of &acpi_dev->dev.kobj, &dev->kobji with these two ret's)

---
 drivers/acpi/glue.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)
drivers/acpi/glue.c +3 -0
index 4af6301..f146165 100644
@@ -166,6 +166,9 @@ static int acpi_bind_one(struct device *dev, acpi_handle handle)
 				"firmware_node");
 		ret = sysfs_create_link(&acpi_dev->dev.kobj, &dev->kobj,
 				"physical_node");
+		if (ret) {
+			printk(KERN_WARNING "dev%d: Failed to get exception\n", ret);
+		}
 		if (acpi_dev->wakeup.flags.valid) {
 			device_set_wakeup_capable(dev, true);
 			device_set_wakeup_enable(dev,
Signature · 1 line
1.7.1.rc1.21.gf3bd6
#27 lore raw

PATCH 4/5 block:cryptoloop Fix warning: variable 'cipher' set but not used

In reply to Justin P. Mattock

Im getting this when compiling on gcc 4.6.0
CC [M] drivers/block/cryptoloop.o
drivers/block/cryptoloop.c: In function 'cryptoloop_init':
drivers/block/cryptoloop.c:46:8: warning: variable 'cipher' set but not used The below fixes it for me. Please have a look and let me know.

---
 drivers/block/cryptoloop.c |    2 --
 1 files changed, 0 insertions(+), 2 deletions(-)
drivers/block/cryptoloop.c +0 -2
index 8b6bb76..fb8a6fd 100644
@@ -43,7 +43,6 @@ cryptoloop_init(struct loop_device *lo, const struct loop_info64 *info)
 	int cipher_len;
 	int mode_len;
 	char cms[LO_NAME_SIZE];			/* cipher-mode string */
-	char *cipher;
 	char *mode;
 	char *cmsp = cms;			/* c-m string pointer */
 	struct crypto_blkcipher *tfm;
@@ -56,7 +55,6 @@ cryptoloop_init(struct loop_device *lo, const struct loop_info64 *info)
 	strncpy(cms, info->lo_crypt_name, LO_NAME_SIZE);
 	cms[LO_NAME_SIZE - 1] = 0;
 
-	cipher = cmsp;
 	cipher_len = strcspn(cmsp, "-");
 
 	mode = cmsp + cipher_len;
Signature · 1 line
1.7.1.rc1.21.gf3bd6
#30 lore raw

Re: [PATCH 5/5]bluetooth:hci_bcsp Fix operation on 'bcsp->msgq_txseq' may be undefined

In reply to Justin P. Mattock

Hi Justin,

Quoted 26 lines · Justin P. Mattock

Im seeing this building the kernel with gcc 4.6.0
CC [M] drivers/bluetooth/hci_bcsp.o
drivers/bluetooth/hci_bcsp.c: In function 'bcsp_prepare_pkt':
drivers/bluetooth/hci_bcsp.c:247:20: warning: operation on 'bcsp->msgq_txseq' may be undefined

Hopefully the below is a fix for this. Please let me know.

---
 drivers/bluetooth/hci_bcsp.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)
drivers/bluetooth/hci_bcsp.c +1 -1
index 40aec0f..0f892e7 100644
@@ -182,7 +182,7 @@ static struct sk_buff *bcsp_prepare_pkt(struct bcsp_struct *bcsp, u8 *data,
 	struct sk_buff *nskb;
 	u8 hdr[4], chan;
 	u16 BCSP_CRC_INIT(bcsp_txmsg_crc);
-	int rel, i;
+	int rel, i, ret;
 
 	switch (pkt_type) {
 	case HCI_ACLDATA_PKT:

drivers/bluetooth/hci_bcsp.c static struct sk_buff *bcsp_prepare_pkt(struct bcsp_struct *bcsp, u8 *data, · line 248

Quoted 8 lines
drivers/bluetooth/hci_bcsp.c +2 -2
@@ -243,8 +243,8 @@ static struct sk_buff *bcsp_prepare_pkt(struct bcsp_struct *bcsp, u8 *data,
 
 	if (rel) {
 		hdr[0] |= 0x80 + bcsp->msgq_txseq;
-		BT_DBG("Sending packet with seqno %u", bcsp->msgq_txseq);
-		bcsp->msgq_txseq = ++(bcsp->msgq_txseq) & 0x07;
+		BT_DBG("Sending packet with seqno %u", bcsp->msgq_txseq | ret);
+		ret = ++(bcsp->msgq_txseq) & 0x07;
 	}

What are trying to do here? That is completely wrong, you are losting the next txseq to be sent.

And please do not bother the linux-bluetooth mailing list with patches to other subsystems. Send them in a way that only Bluetooth patches will come to linux-bluetooth.

Regards,

Signature · 2 lines
Gustavo F. Padovan
http://padovan.org
maintainer
#2 lore raw

Re: [PATCH 1/5]security:key.c Fix warning: variable 'key' set but not used

In reply to Justin P. Mattock
Quoted 4 lines · Justin P. Mattock

In this case the safest approach(in my mind) would be to just mark the integer __unused. Keep in mind though Im not certain if this is the right place for this value i.e. will this effect *instkey or not(please check).

This is the wrong approach. Either the variable should be got rid of, or it should be used to replace all the other calls to key_ref_to_ptr() in keyctl_describe_key().

David

maintainer Acked-by on v1 2/5
#7 lore raw

Re: [PATCH 2/5]security:ebitmap.c Fix warning: variable 'e_sft' set but not used

In reply to Justin P. Mattock
Quoted 8 lines · Justin P. Mattock

gcc is giving me this during compiling:
CC security/selinux/ss/ebitmap.o
security/selinux/ss/ebitmap.c: In function 'ebitmap_netlbl_import':
security/selinux/ss/ebitmap.c:159:27: warning: variable 'e_sft' set but not used

The below fixes this warning for me.
(please check this whenever you have time).

(though I wonder if e_sft should be used for something...)

maintainer
#10 lore raw

Re: [PATCH 3/5]acpi:glue.c Fix warning: variable 'ret' set but not used

In reply to Justin P. Mattock

drivers/acpi/glue.c static int acpi_bind_one(struct device *dev, acpi_handle handle) · line 171

Quoted 3 lines · Justin P. Mattock
drivers/acpi/glue.c +3 -0
+		if (ret) {
+			printk(KERN_WARNING "dev%d: Failed to get exception\n", ret);
+		}

That's not a good warning because it's a meaningless string and you're passing the error number to the dev%d.

Better would perhaps be:

"dev%d: Failed to create physical_node sysfs link: %d\n"

Note also that you're only checking the result of one sysfs_create_link(). You should probably check both.

Also you're introducing a pair of unnecessary braces as there's only one statement in the if-body.

David

maintainer Acked-by on v1 4/5
#28 lore raw

Re: [PATCH 4/5]block:cryptoloop Fix warning: variable 'cipher' set but not used

In reply to Justin P. Mattock
Quoted 7 lines · Justin P. Mattock

Im getting this when compiling on gcc 4.6.0
CC [M] drivers/block/cryptoloop.o
drivers/block/cryptoloop.c: In function 'cryptoloop_init':
drivers/block/cryptoloop.c:46:8: warning: variable 'cipher' set but not used The below fixes it for me. Please have a look and let me know.

maintainer
#31 lore raw

Re: [PATCH 5/5]bluetooth:hci_bcsp Fix operation on 'bcsp->msgq_txseq' may be undefined

In reply to Justin P. Mattock

drivers/bluetooth/hci_bcsp.c static struct sk_buff *bcsp_prepare_pkt(struct bcsp_struct *bcsp, u8 *data, · line 247

Quoted 4 lines · Justin P. Mattock
drivers/bluetooth/hci_bcsp.c +2 -2
-		BT_DBG("Sending packet with seqno %u", bcsp->msgq_txseq);
-		bcsp->msgq_txseq = ++(bcsp->msgq_txseq) & 0x07;
+		BT_DBG("Sending packet with seqno %u", bcsp->msgq_txseq | ret);
+		ret = ++(bcsp->msgq_txseq) & 0x07;

I don't know what you're trying to do here, but you seem to be trying to send the computed value back in time.

The problem is that the compiler is confused about why a '++' operator makes any sense here. It doesn't. It should be a '+ 1' instead. I think what you want is:

	-	bcsp->msgq_txseq = ++(bcsp->msgq_txseq) & 0x07;
	+	bcsp->msgq_txseq = (bcsp->msgq_txseq + 1) & 0x07;

David

maintainer
#34 lore raw

PATCH 1/1 Bluetooth: Fix abuse of the preincrement operator

In reply to Justin P. Mattock

Fix abuse of the preincrement operator as detected when building with gcc 4.6.0:

CC [M] drivers/bluetooth/hci_bcsp.o
drivers/bluetooth/hci_bcsp.c: In function 'bcsp_prepare_pkt':
drivers/bluetooth/hci_bcsp.c:247:20: warning: operation on 'bcsp->msgq_txseq' may be undefined

---

 drivers/bluetooth/hci_bcsp.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/bluetooth/hci_bcsp.c +1 -1
index 40aec0f..42d69d4 100644
@@ -244,7 +244,7 @@ static struct sk_buff *bcsp_prepare_pkt(struct bcsp_struct *bcsp, u8 *data,
 	if (rel) {
 		hdr[0] |= 0x80 + bcsp->msgq_txseq;
 		BT_DBG("Sending packet with seqno %u", bcsp->msgq_txseq);
-		bcsp->msgq_txseq = ++(bcsp->msgq_txseq) & 0x07;
+		bcsp->msgq_txseq = (bcsp->msgq_txseq + 1) & 0x07;
 	}
 
 	if (bcsp->use_crc)
#32 lore raw

Re: [PATCH 5/5]bluetooth:hci_bcsp Fix operation on 'bcsp->msgq_txseq' may be undefined

In reply to David Howells
Quoted 11 lines · David Howells

drivers/bluetooth/hci_bcsp.c static struct sk_buff *bcsp_prepare_pkt(struct bcsp_struct *bcsp, u8 *data, · line 247

Quoted 4 lines · Justin P. Mattock
drivers/bluetooth/hci_bcsp.c +2 -2
-		BT_DBG("Sending packet with seqno %u", bcsp->msgq_txseq);
-		bcsp->msgq_txseq = ++(bcsp->msgq_txseq) & 0x07;
+		BT_DBG("Sending packet with seqno %u", bcsp->msgq_txseq | ret);
+		ret = ++(bcsp->msgq_txseq) & 0x07;

I don't know what you're trying to do here, but you seem to be trying to send the computed value back in time.

The problem is that the compiler is confused about why a '++' operator makes

It's even worse as that expression is explicitly undefined (and should be fixed anyways and unconditionally).

Quoted 5 lines

any sense here. It doesn't. It should be a '+ 1' instead. I think what you want is:

	-	bcsp->msgq_txseq = ++(bcsp->msgq_txseq) & 0x07;
	+	bcsp->msgq_txseq = (bcsp->msgq_txseq + 1) & 0x07;

Yes, that's looks like the most probable intention of it - at least for one who doesn't know the bluetooth code.

Bernd

Signature · 2 lines
Bernd Petrovitsch                  Email : [email protected]
                     LUGA : http://www.luga.at
maintainer
#4 lore raw

PATCH 1/1 KEYS: Use the variable 'key' in keyctl_describe_key()

In reply to Justin P. Mattock

keyctl_describe_key() turns the key reference it gets into a usable key pointer and assigns that to a variable called 'key', which it then ignores in favour of recomputing the key pointer each time it needs it. Make it use the precomputed pointer instead.

Without this patch, gcc 4.6 reports that the variable key is set but not used:

building with gcc 4.6 I'm getting a warning message:
CC security/keys/keyctl.o
security/keys/keyctl.c: In function 'keyctl_describe_key':
security/keys/keyctl.c:472:14: warning: variable 'key' set but not used

---

 security/keys/keyctl.c |   12 +++++-------
 1 files changed, 5 insertions(+), 7 deletions(-)
security/keys/keyctl.c +5 -7
index 639226a..b2b0998 100644
@@ -505,13 +505,11 @@ okay:
 
 	ret = snprintf(tmpbuf, PAGE_SIZE - 1,
 		       "%s;%d;%d;%08x;%s",
-		       key_ref_to_ptr(key_ref)->type->name,
-		       key_ref_to_ptr(key_ref)->uid,
-		       key_ref_to_ptr(key_ref)->gid,
-		       key_ref_to_ptr(key_ref)->perm,
-		       key_ref_to_ptr(key_ref)->description ?
-		       key_ref_to_ptr(key_ref)->description : ""
-		       );
+		       key->type->name,
+		       key->uid,
+		       key->gid,
+		       key->perm,
+		       key->description ?: "");
 
 	/* include a NUL char at the end of the data */
 	if (ret > PAGE_SIZE - 1)
Acked-by on v1 1/1
#35 lore raw

Re: [PATCH] Bluetooth: Fix abuse of the preincrement operator

In reply to David Howells

Hi David,

Quoted 20 lines · David Howells

Fix abuse of the preincrement operator as detected when building with gcc 4.6.0:

CC [M] drivers/bluetooth/hci_bcsp.o
drivers/bluetooth/hci_bcsp.c: In function 'bcsp_prepare_pkt':
drivers/bluetooth/hci_bcsp.c:247:20: warning: operation on 'bcsp->msgq_txseq' may be undefined

---

 drivers/bluetooth/hci_bcsp.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/bluetooth/hci_bcsp.c +0 -0
index 40aec0f..42d69d4 100644

drivers/bluetooth/hci_bcsp.c static struct sk_buff *bcsp_prepare_pkt(struct bcsp_struct *bcsp, u8 *data, · line 250

Quoted 8 lines
drivers/bluetooth/hci_bcsp.c +1 -1
@@ -244,7 +244,7 @@ static struct sk_buff *bcsp_prepare_pkt(struct bcsp_struct *bcsp, u8 *data,
 	if (rel) {
 		hdr[0] |= 0x80 + bcsp->msgq_txseq;
 		BT_DBG("Sending packet with seqno %u", bcsp->msgq_txseq);
-		bcsp->msgq_txseq = ++(bcsp->msgq_txseq) & 0x07;
+		bcsp->msgq_txseq = (bcsp->msgq_txseq + 1) & 0x07;
 	}
 
 	if (bcsp->use_crc)
Signature · 2 lines
Gustavo F. Padovan
http://padovan.org
#37 lore raw

Re: [PATCH] Bluetooth: Fix abuse of the preincrement operator

In reply to David Howells
Quoted 21 lines · David Howells

Fix abuse of the preincrement operator as detected when building with gcc 4.6.0:

CC [M] drivers/bluetooth/hci_bcsp.o
drivers/bluetooth/hci_bcsp.c: In function 'bcsp_prepare_pkt':
drivers/bluetooth/hci_bcsp.c:247:20: warning: operation on 'bcsp->msgq_txseq' may be undefined

---

  drivers/bluetooth/hci_bcsp.c |    2 +-
  1 files changed, 1 insertions(+), 1 deletions(-)
drivers/bluetooth/hci_bcsp.c +0 -0
index 40aec0f..42d69d4 100644

drivers/bluetooth/hci_bcsp.c static struct sk_buff *bcsp_prepare_pkt(struct bcsp_struct *bcsp, u8 *data, · line 250

Quoted 8 lines
drivers/bluetooth/hci_bcsp.c +1 -1
@@ -244,7 +244,7 @@ static struct sk_buff *bcsp_prepare_pkt(struct bcsp_struct *bcsp, u8 *data,
  	if (rel) {
  		hdr[0] |= 0x80 + bcsp->msgq_txseq;
  		BT_DBG("Sending packet with seqno %u", bcsp->msgq_txseq);
-		bcsp->msgq_txseq = ++(bcsp->msgq_txseq)&  0x07;
+		bcsp->msgq_txseq = (bcsp->msgq_txseq + 1)&  0x07;
  	}
 
  	if (bcsp->use_crc)

ahh.. so it's o.k. to add the value after bcsp->msgq_txseq instead of before. Anyways build clean over here..

Thanks!

Justin P. Mattock

#3 lore raw

Re: [PATCH 1/5]security:key.c Fix warning: variable 'key' set but not used

In reply to David Howells
Quoted 7 lines · David Howells
Quoted 4 lines · Justin P. Mattock

In this case the safest approach(in my mind) would be to just mark the integer __unused. Keep in mind though Im not certain if this is the right place for this value i.e. will this effect *instkey or not(please check).

Quoted 6 lines

This is the wrong approach. Either the variable should be got rid of, or it should be used to replace all the other calls to key_ref_to_ptr() in keyctl_describe_key().

David

I see your patch you sent for this.. vary nice!

Thanks!

Justin P. Mattock

#8 lore raw

Re: [PATCH 2/5]security:ebitmap.c Fix warning: variable 'e_sft' set but not used

In reply to David Howells
Quoted 7 lines · David Howells
Quoted 5 lines · Justin P. Mattock

gcc is giving me this during compiling:
CC security/selinux/ss/ebitmap.o
security/selinux/ss/ebitmap.c: In function 'ebitmap_netlbl_import':
security/selinux/ss/ebitmap.c:159:27: warning: variable 'e_sft' set but not used

Quoted 8 lines
Quoted 3 lines

The below fixes this warning for me.
(please check this whenever you have time).

(though I wonder if e_sft should be used for something...)

alright..

Justin P. Mattock

#11 lore raw

Re: [PATCH 3/5]acpi:glue.c Fix warning: variable 'ret' set but not used

In reply to David Howells
Quoted 9 lines · David Howells

drivers/acpi/glue.c static int acpi_bind_one(struct device *dev, acpi_handle handle) · line 171

Quoted 3 lines · Justin P. Mattock
drivers/acpi/glue.c +3 -0
+		if (ret) {
+			printk(KERN_WARNING "dev%d: Failed to get exception\n", ret);
+		}

That's not a good warning because it's a meaningless string and you're passing the error number to the dev%d.

Quoted 4 lines

Better would perhaps be:

"dev%d: Failed to create physical_node sysfs link: %d\n"

I'll throw that in.

Quoted 3 lines

Note also that you're only checking the result of one sysfs_create_link(). You should probably check both.

this is where I get confused with: &acpi_dev->dev.kobj, &dev->kobji it's like a criss cross of code

Quoted 5 lines

Also you're introducing a pair of unnecessary braces as there's only one statement in the if-body.

David

would just removing ret be good or will things go out of whack because of no ret

Justin P. Mattock

#33 lore raw

Re: [PATCH 5/5]bluetooth:hci_bcsp Fix operation on 'bcsp->msgq_txseq' may be undefined

In reply to David Howells
Quoted 10 lines · David Howells

drivers/bluetooth/hci_bcsp.c static struct sk_buff *bcsp_prepare_pkt(struct bcsp_struct *bcsp, u8 *data,

Quoted 4 lines · Justin P. Mattock
drivers/bluetooth/hci_bcsp.c +2 -2
-		BT_DBG("Sending packet with seqno %u", bcsp->msgq_txseq);
-		bcsp->msgq_txseq = ++(bcsp->msgq_txseq)&  0x07;
+		BT_DBG("Sending packet with seqno %u", bcsp->msgq_txseq | ret);
+		ret = ++(bcsp->msgq_txseq)&  0x07;

I don't know what you're trying to do here, but you seem to be trying to send the computed value back in time.

I was under the impression that hdr[0] |= 0x80 + bcsp->msgq_txseq; is computing a value for BT_DBG then ret = ++(bcsp->msgq_txseq)& 0x07 computes a value as well i.e.

BT_DBG("Sending packet with seqno %u", hdr[0] | ret);

Quoted 9 lines

The problem is that the compiler is confused about why a '++' operator makes any sense here. It doesn't. It should be a '+ 1' instead. I think what you want is:

	-	bcsp->msgq_txseq = ++(bcsp->msgq_txseq)&  0x07;
	+	bcsp->msgq_txseq = (bcsp->msgq_txseq + 1)&  0x07;

David

yeah I did play around with the ++ and noticed the compiler would be satisfied if the ++ was not there, but didn't think to just add a + 1

Justin P. Mattock

maintainer
#12 lore raw

Re: [PATCH 3/5]acpi:glue.c Fix warning: variable 'ret' set but not used

In reply to Justin P. Mattock
Quoted 2 lines · Justin P. Mattock

would just removing ret be good or will things go out of whack because of no ret

Don't you then get warnings for not capturing the result?

David

#13 lore raw

Re: [PATCH 3/5]acpi:glue.c Fix warning: variable 'ret' set but not used

Quoted 9 lines · David Howells
Quoted 2 lines · Justin P. Mattock

would just removing ret be good or will things go out of whack because of no ret

Don't you then get warnings for not capturing the result?

David

not sure if it would give warnings for not capturing the result. then doing this would be the way to go.

if (ret) {
printk(KERN_WARNING "dev%d: Failed to create physical_node sysfs link: %d\n"); }

but like you had said unnecessary braces, and only one statement I'll look at this some more too see if I come up with anything.

Justin P. Mattock

#26 lore raw

Re: [PATCH 3/5]acpi:glue.c Fix warning: variable 'ret' set but not used

In reply to David Howells

no need to have extra cc's on this, so I took some people off since they dont pertain to this area.

Justin P. Mattock

maintainer
#5 lore raw

Re: [Keyrings] [PATCH] KEYS: Use the variable 'key' in keyctl_describe_key()

In reply to David Howells
Quoted 7 lines · David Howells

keyctl_describe_key() turns the key reference it gets into a usable key pointer and assigns that to a variable called 'key', which it then ignores in favour of recomputing the key pointer each time it needs it. Make it use the precomputed pointer instead.

Without this patch, gcc 4.6 reports that the variable key is set but not used:

Quoted 7 lines

building with gcc 4.6 I'm getting a warning message:
CC security/keys/keyctl.o
security/keys/keyctl.c: In function 'keyctl_describe_key':
security/keys/keyctl.c:472:14: warning: variable 'key' set but not used

Applied to
git://git.kernel.org/pub/scm/linux/kernel/git/jmorris/security-testing-2.6#next

Signature · 2 lines
James Morris
<[email protected]>
#14 lore raw

Re: [PATCH 3/5]acpi:glue.c Fix warning: variable 'ret' set but not used

In reply to David Howells

o.k. after stepping out for a while.. I'm finally sitting down and looking at this. below is what I came up with.. hopefully it's in the area/vecinity of what might be a good idea for this(if not then let me know)

From da5cfa463f29ff3fe4af3874649db0809e50ab96 Mon Sep 17 00:00:00 2001
From: Justin P. Mattock <[email protected]>
Date: Mon, 28 Jun 2010 20:14:50 -0700
Subject: [PATCH] glue.c

---
 drivers/acpi/glue.c |   12 +++++++++---
 1 files changed, 9 insertions(+), 3 deletions(-)
drivers/acpi/glue.c +9 -3
index 4af6301..970d7f3 100644
@@ -145,6 +145,7 @@ static int acpi_bind_one(struct device *dev, acpi_handle handle)
 {
 	struct acpi_device *acpi_dev;
 	acpi_status status;
+	int fn, pn;
 
 	if (dev->archdata.acpi_handle) {
 		dev_warn(dev, "Drivers changed 'acpi_handle'\n");
@@ -160,12 +161,17 @@ static int acpi_bind_one(struct device *dev, acpi_handle handle)
 
 	status = acpi_bus_get_device(handle, &acpi_dev);
 	if (!ACPI_FAILURE(status)) {
-		int ret;
 
-		ret = sysfs_create_link(&dev->kobj, &acpi_dev->dev.kobj,
+		fn = sysfs_create_link(&dev->kobj, &acpi_dev->dev.kobj,
 				"firmware_node");
-		ret = sysfs_create_link(&acpi_dev->dev.kobj, &dev->kobj,
+		pn = sysfs_create_link(&acpi_dev->dev.kobj, &dev->kobj,
 				"physical_node");
+	if (fn) {
+ 			printk(KERN_WARNING "dev%d: Failed to create firmware_node: %d\n", status, fn);
+	}else if (pn) {
+			printk(KERN_WARNING "dev%d: Failed to create physical_node: %d\n", status, pn);
+ 			return 0;
+		}
 		if (acpi_dev->wakeup.flags.valid) {
 			device_set_wakeup_capable(dev, true);
 			device_set_wakeup_enable(dev,
Signature · 8 lines
1.7.1.rc1.21.gf3bd6


keep in mind Im not exactly sure what should go into the printk
as for words to say, and functions, so I just used status, fn/pn
for the two because I was getting a not enough function error.

Justin P. Mattock
maintainer
#15 lore raw

Re: [PATCH 3/5]acpi:glue.c Fix warning: variable 'ret' set but not used

drivers/acpi/glue.c static int acpi_bind_one(struct device *dev, acpi_handle handle) · line 174

Quoted 8 lines · Justin P. Mattock
(quoted diff) +2 -0
+	if (fn) {
+ 			printk(KERN_WARNING "dev%d: Failed to create

firmware_node: %d\n", status, fn);

(quoted diff) +2 -0
+	}else if (pn) {
+			printk(KERN_WARNING "dev%d: Failed to create

physical_node: %d\n", status, pn);

drivers/acpi/glue.c +2 -0
+ 			return 0;
+		}

The if-statement should be correctly indented (it's inside another if-body, so needs to be one more tab over) and there needs to be a space before the else.

You should probably split your printks up so they don't exceed 80 chars too, for example:

			printk(KERN_WARNING
			       "dev%d: Failed to create physical_node: %d\n",
			       status, pn);

Also 'status' is probably the wrong thing to print as the number in "dev%d". If it worked, that should be unconditionally AE_OK, I think. Can you not use dev_warn() or similar instead or printk?

David

#16 lore raw

Re: [PATCH 3/5]acpi:glue.c Fix warning: variable 'ret' set but not used

Quoted 15 lines · David Howells

drivers/acpi/glue.c static int acpi_bind_one(struct device *dev, acpi_handle handle) · line 174

Quoted 8 lines · Justin P. Mattock
(quoted diff) +2 -0
+	if (fn) {
+ 			printk(KERN_WARNING "dev%d: Failed to create

firmware_node: %d\n", status, fn);

(quoted diff) +2 -0
+	}else if (pn) {
+			printk(KERN_WARNING "dev%d: Failed to create

physical_node: %d\n", status, pn);

drivers/acpi/glue.c +2 -0
+ 			return 0;
+		}

The if-statement should be correctly indented (it's inside another if-body, so needs to be one more tab over) and there needs to be a space before the else.

o.k., so it should look something like this:

if (fn) {
	code...
	} else if (pn) {
Quoted 7 lines

You should probably split your printks up so they don't exceed 80 chars too, for example:

			printk(KERN_WARNING
			       "dev%d: Failed to create physical_node: %d\n",
			       status, pn);
Quoted 6 lines

Also 'status' is probably the wrong thing to print as the number in "dev%d". If it worked, that should be unconditionally AE_OK, I think. Can you not use dev_warn() or similar instead or printk?

David

alright, I'll look at this today. I'm not the best at making printks in fact I'm more intimidated by them..(so with this in mind, I'm going to sit and make myself learn this, so I atleast have a better idea of doing these than I have now.)

Justin P. Mattock

#17 lore raw

Re: [PATCH 3/5]acpi:glue.c Fix warning: variable 'ret' set but not used

In reply to David Howells
Quoted 22 lines · David Howells

Review

Quoted 8 lines · Justin P. Mattock
(quoted diff) +2 -0
+	if (fn) {
+ 			printk(KERN_WARNING "dev%d: Failed to create

firmware_node: %d\n", status, fn);

(quoted diff) +2 -0
+	}else if (pn) {
+			printk(KERN_WARNING "dev%d: Failed to create

physical_node: %d\n", status, pn);

(quoted diff) +2 -0
+ 			return 0;
+		}

The if-statement should be correctly indented (it's inside another if-body, so needs to be one more tab over) and there needs to be a space before the else.

You should probably split your printks up so they don't exceed 80 chars too, for example:

			printk(KERN_WARNING
			       "dev%d: Failed to create physical_node: %d\n",
			       status, pn);
Quoted 6 lines

Also 'status' is probably the wrong thing to print as the number in "dev%d". If it worked, that should be unconditionally AE_OK, I think. Can you not use dev_warn() or similar instead or printk?

David

o.k. heres another go at this.. this goes through, using dev_warn but am uncertain about using these three for the right info dev, %p, dev_acpi

but give it a look whenever you have the time, and let me know then I'll go from there..

From 34485b5709dc9ad18c57be8c672236580300e05c Mon Sep 17 00:00:00 2001
From: Justin P. Mattock <[email protected]>
Date: Tue, 29 Jun 2010 14:47:42 -0700
Subject: [PATCH ]ACPI:glue.c

---
 drivers/acpi/glue.c |   15 ++++++++++++---
 1 files changed, 12 insertions(+), 3 deletions(-)
drivers/acpi/glue.c +12 -3
index 4af6301..69ca24d 100644
@@ -145,6 +145,7 @@ static int acpi_bind_one(struct device *dev, acpi_handle handle)
 {
 	struct acpi_device *acpi_dev;
 	acpi_status status;
+	int fn, pn;
 
 	if (dev->archdata.acpi_handle) {
 		dev_warn(dev, "Drivers changed 'acpi_handle'\n");
@@ -160,12 +161,20 @@ static int acpi_bind_one(struct device *dev, acpi_handle handle)
 
 	status = acpi_bus_get_device(handle, &acpi_dev);
 	if (!ACPI_FAILURE(status)) {
-		int ret;
 
-		ret = sysfs_create_link(&dev->kobj, &acpi_dev->dev.kobj,
+		fn = sysfs_create_link(&dev->kobj, &acpi_dev->dev.kobj,
 				"firmware_node");
-		ret = sysfs_create_link(&acpi_dev->dev.kobj, &dev->kobj,
+		pn = sysfs_create_link(&acpi_dev->dev.kobj, &dev->kobj,
 				"physical_node");
+	if (fn) {
+		dev_warn(dev, "dev:%p Failed to create firmware_node: %d\n",
+			acpi_dev, fn);
+
+		} else if (pn) {
+		dev_warn(dev, "dev:%p Failed to create physical_node: %d\n",
+			acpi_dev, pn);
+			return AE_ERROR;
+		}
 		if (acpi_dev->wakeup.flags.valid) {
 			device_set_wakeup_capable(dev, true);
 			device_set_wakeup_enable(dev,
Signature · 4 lines
1.7.1.rc1.21.gf3bd6


Justin P. Mattock
maintainer
#18 lore raw

Re: [PATCH 3/5]acpi:glue.c Fix warning: variable 'ret' set but not used

drivers/acpi/glue.c static int acpi_bind_one(struct device *dev, acpi_handle handle) · line 169

Quoted 10 lines · Justin P. Mattock
drivers/acpi/glue.c +3 -3
 	if (!ACPI_FAILURE(status)) {
-		int ret;
 
-		ret = sysfs_create_link(&dev->kobj, &acpi_dev->dev.kobj,
+		fn = sysfs_create_link(&dev->kobj, &acpi_dev->dev.kobj,
 				"firmware_node");
-		ret = sysfs_create_link(&acpi_dev->dev.kobj, &dev->kobj,
+		pn = sysfs_create_link(&acpi_dev->dev.kobj, &dev->kobj,
 				"physical_node");
+	if (fn) {

That new if-statement still needs indenting one more tab stop. It's indented the same as the previous if-statement, but is actually in the body of that previous if-statement.

The body of the second if-statement should be indented one tab beyond the if, and else/else-if statements and the final closing brace should be indented level with the if:

	if (...) {
		body;
	} else if (...) {
		body;
	} else {
		body;
	}

so that they line up vertically.

drivers/acpi/glue.c static int acpi_bind_one(struct device *dev, acpi_handle handle) · line 171

Quoted 2 lines
drivers/acpi/glue.c +2 -0
+		dev_warn(dev, "dev:%p Failed to create firmware_node: %d\n",
+			acpi_dev, fn);

The "dev:%p " seems like it ought to be superfluous if you're using dev_warn(), and certainly, returning the pointer isn't really useful, I suspect.

However, at this point you have two device struct pointers: dev and &acip_dev->dev, so printing them both is may be good. Perhaps something like:

+ dev_warn(&acpi_dev->dev,
+ "Failed to create firmware_node link to %s %s: %d\n",
+ dev_driver_string(dev), dev_name(dev), fn);

David

#19 lore raw

Re: [PATCH 3/5]acpi:glue.c Fix warning: variable 'ret' set but not used

Quoted 29 lines · David Howells

drivers/acpi/glue.c static int acpi_bind_one(struct device *dev, acpi_handle handle) · line 169

Quoted 10 lines · Justin P. Mattock
  	if (!ACPI_FAILURE(status)) {
drivers/acpi/glue.c +3 -3
-		int ret;
 
-		ret = sysfs_create_link(&dev->kobj,&acpi_dev->dev.kobj,
+		fn = sysfs_create_link(&dev->kobj,&acpi_dev->dev.kobj,
  				"firmware_node");
-		ret = sysfs_create_link(&acpi_dev->dev.kobj,&dev->kobj,
+		pn = sysfs_create_link(&acpi_dev->dev.kobj,&dev->kobj,
  				"physical_node");
+	if (fn) {

That new if-statement still needs indenting one more tab stop. It's indented the same as the previous if-statement, but is actually in the body of that previous if-statement.

The body of the second if-statement should be indented one tab beyond the if, and else/else-if statements and the final closing brace should be indented level with the if:

	if (...) {
		body;
	} else if (...) {
		body;
	} else {
		body;
	}
Quoted 1 line

so that they line up vertically.

Thanks for the info on this, I really appreciate it. I'll look at this today, and resend.

Quoted 8 lines

drivers/acpi/glue.c static int acpi_bind_one(struct device *dev, acpi_handle handle) · line 171

Quoted 3 lines
drivers/acpi/glue.c +2 -0
+		dev_warn(dev, "dev:%p Failed to create firmware_node: %d\n",
+			acpi_dev, fn);

The "dev:%p " seems like it ought to be superfluous if you're using dev_warn(), and certainly, returning the pointer isn't really useful, I suspect.

I kept receiving an new warning for using acpi_dev the %p was the only option I saw in the Documentation that worked

Quoted 9 lines

However, at this point you have two device struct pointers: dev and &acip_dev->dev, so printing them both is may be good. Perhaps something like:

(quoted diff) +3 -0
+		dev_warn(&acpi_dev->dev,
+			 "Failed to create firmware_node link to %s %s: %d\n",
+			 dev_driver_string(dev), dev_name(dev), fn);

David

o.k. I'll look at this today, and see if I can find/locate the device name and string for these.

Justin P. Mattock

#20 lore raw

Re: [PATCH 3/5]acpi:glue.c Fix warning: variable 'ret' set but not used

In reply to David Howells

o.k. hopefully this is getting close to being right.. I ended up spending the later half of the morning looking for dev_driver_string(dev) until I read device.h and realized you actually use that it's self to gather the debug info etc..(I admit it, I'm a newbie!)

anyways here is the updated patch, let me know if something need a changing..

From 16df81551d1899e650ae28ea8d41931f7c391c7a Mon Sep 17 00:00:00 2001
From: Justin P. Mattock <[email protected]>
Date: Wed, 30 Jun 2010 12:34:32 -0700
Subject: [PATCH]acpi:glue.c Fix Fix warning: variable 'ret' set but not used

Fix a warning message generated by gcc:
Im getting a warning message when building with gcc 4.6.0
CC drivers/acpi/glue.o
drivers/acpi/glue.c: In function 'acpi_bind_one':
drivers/acpi/glue.c:163:7: warning: variable 'ret' set but not used

---
 drivers/acpi/glue.c |   16 +++++++++++++---
 1 files changed, 13 insertions(+), 3 deletions(-)
drivers/acpi/glue.c +13 -3
index 4af6301..11ad510 100644
@@ -145,6 +145,7 @@ static int acpi_bind_one(struct device *dev, acpi_handle handle)
 {
 	struct acpi_device *acpi_dev;
 	acpi_status status;
+	int fn, pn;
 
 	if (dev->archdata.acpi_handle) {
 		dev_warn(dev, "Drivers changed 'acpi_handle'\n");
@@ -160,12 +161,21 @@ static int acpi_bind_one(struct device *dev, acpi_handle handle)
 
 	status = acpi_bus_get_device(handle, &acpi_dev);
 	if (!ACPI_FAILURE(status)) {
-		int ret;
 
-		ret = sysfs_create_link(&dev->kobj, &acpi_dev->dev.kobj,
+		fn = sysfs_create_link(&dev->kobj, &acpi_dev->dev.kobj,
 				"firmware_node");
-		ret = sysfs_create_link(&acpi_dev->dev.kobj, &dev->kobj,
+		pn = sysfs_create_link(&acpi_dev->dev.kobj, &dev->kobj,
 				"physical_node");
+		if (fn) {
+			dev_warn(&acpi_dev->dev,
+				"Failed to create firmware_node link to %s %s: %d\n",
+				dev_driver_string(dev), dev_name(dev), fn);
+		} else if (pn) {
+			dev_warn(&acpi_dev->dev,
+				"Failed to create physical_node link to %s %s: %d\n",
+				dev_driver_string(dev), dev_name(dev), pn);
+				return AE_ERROR;
+		}			
 		if (acpi_dev->wakeup.flags.valid) {
 			device_set_wakeup_capable(dev, true);
 			device_set_wakeup_enable(dev,
Signature · 6 lines
1.7.1.rc1.21.gf3bd6


cheers,

Justin P. Mattock
Applied
#36 lore raw

Re: [PATCH] Bluetooth: Fix abuse of the preincrement operator

In reply to Gustavo F. Padovan

From: "Gustavo F. Padovan" <[email protected]>
Date: Mon, 28 Jun 2010 10:12:30 -0300

Quoted 13 lines

Hi David,

Quoted 9 lines · David Howells

Fix abuse of the preincrement operator as detected when building with gcc 4.6.0:

CC [M] drivers/bluetooth/hci_bcsp.o
drivers/bluetooth/hci_bcsp.c: In function 'bcsp_prepare_pkt':
drivers/bluetooth/hci_bcsp.c:247:20: warning: operation on 'bcsp->msgq_txseq' may be undefined

...

Quoted 1 line

Applied, thanks everyone.

maintainer
#21 lore raw

Re: [PATCH 3/5]acpi:glue.c Fix warning: variable 'ret' set but not used

In reply to Justin P. Mattock

drivers/acpi/glue.c static int acpi_bind_one(struct device *dev, acpi_handle handle) · line 178

Quoted 10 lines · Justin P. Mattock
drivers/acpi/glue.c +10 -0
+		if (fn) {
+			dev_warn(&acpi_dev->dev,
+				"Failed to create firmware_node link to %s %s: %d\n",
+				dev_driver_string(dev), dev_name(dev), fn);
+		} else if (pn) {
+			dev_warn(&acpi_dev->dev,
+				"Failed to create physical_node link to %s %s: %d\n",
+				dev_driver_string(dev), dev_name(dev), pn);
+				return AE_ERROR;
+		}			

There's one more question to ask yourself: do you really need two dev_warn() statements? You could have just one that prints both error values:

		if (fn || pn)
			dev_warn(&acpi_dev->dev,
				 "Failed to create link(s) to %s %s:"
				 " fn=%d pn=%d\n",
				 dev_driver_string(dev), dev_name(dev),
				 fn, pn);

Not sure it's worth going that far. You could reduce it still further:

		if (fn || pn)
			dev_warn(&acpi_dev->dev,
				 "Failed to create link(s) to %s %s:"
				 " %d\n",
				 dev_driver_string(dev), dev_name(dev),
				 fn ?: pn);

Is it that important to know which failed to be created, or that both failed to be created?

David

#22 lore raw

Re: [PATCH 3/5]acpi:glue.c Fix warning: variable 'ret' set but not used

Quoted 16 lines · David Howells

drivers/acpi/glue.c static int acpi_bind_one(struct device *dev, acpi_handle handle) · line 178

Quoted 10 lines · Justin P. Mattock
drivers/acpi/glue.c +10 -0
+		if (fn) {
+			dev_warn(&acpi_dev->dev,
+				"Failed to create firmware_node link to %s %s: %d\n",
+				dev_driver_string(dev), dev_name(dev), fn);
+		} else if (pn) {
+			dev_warn(&acpi_dev->dev,
+				"Failed to create physical_node link to %s %s: %d\n",
+				dev_driver_string(dev), dev_name(dev), pn);
+				return AE_ERROR;
+		}			

There's one more question to ask yourself: do you really need two dev_warn() statements? You could have just one that prints both error values:

Quoted 6 lines
		if (fn || pn)
			dev_warn(&acpi_dev->dev,
				 "Failed to create link(s) to %s %s:"
				 " fn=%d pn=%d\n",
				 dev_driver_string(dev), dev_name(dev),
				 fn, pn);

ah... I did think about that a few days ago, but had no idea how to really follow through with this.. and from looking at what you did, it's as simple as a || b

Quoted 9 lines

Not sure it's worth going that far. You could reduce it still further:

		if (fn || pn)
			dev_warn(&acpi_dev->dev,
				 "Failed to create link(s) to %s %s:"
				 " %d\n",
				 dev_driver_string(dev), dev_name(dev),
				 fn ?: pn);

I don't mind resending with your change to this.

Quoted 6 lines

Is it that important to know which failed to be created, or that both failed to be created?

David

maybe a simple test(prog) case can be created to simulate what this is doing, just to make sure.

Justin P. Mattock

#23 lore raw

Re: [PATCH 3/5]acpi:glue.c Fix warning: variable 'ret' set but not used

In reply to David Howells
Quoted 10 lines

Not sure it's worth going that far. You could reduce it still further:

		if (fn || pn)
			dev_warn(&acpi_dev->dev,
				 "Failed to create link(s) to %s %s:"
				 " %d\n",
				 dev_driver_string(dev), dev_name(dev),
				 fn ?: pn);
Quoted 5 lines

Is it that important to know which failed to be created, or that both failed to be created?

David

I like this..

fn ?: pn (will this give us the results from the above question? _both failed to be created_)
a bit confused with the whole: "?:" though
*condition ? value if true : value if false* (what if both are true what if both are false or does it matter?)

here is the patch itself with the change:

Fix a warning message generated by gcc:
Im getting a warning message when building with gcc 4.6.0
CC drivers/acpi/glue.o
drivers/acpi/glue.c: In function 'acpi_bind_one':
drivers/acpi/glue.c:163:7: warning: variable 'ret' set but not used

---
 drivers/acpi/glue.c |   14 +++++++++++---
 1 files changed, 11 insertions(+), 3 deletions(-)
drivers/acpi/glue.c +11 -3
index 4af6301..23b16e6 100644
@@ -145,6 +145,7 @@ static int acpi_bind_one(struct device *dev, acpi_handle handle)
 {
 	struct acpi_device *acpi_dev;
 	acpi_status status;
+	int fn, pn;
 
 	if (dev->archdata.acpi_handle) {
 		dev_warn(dev, "Drivers changed 'acpi_handle'\n");
@@ -160,12 +161,19 @@ static int acpi_bind_one(struct device *dev, acpi_handle handle)
 
 	status = acpi_bus_get_device(handle, &acpi_dev);
 	if (!ACPI_FAILURE(status)) {
-		int ret;
 
-		ret = sysfs_create_link(&dev->kobj, &acpi_dev->dev.kobj,
+		fn = sysfs_create_link(&dev->kobj, &acpi_dev->dev.kobj,
 				"firmware_node");
-		ret = sysfs_create_link(&acpi_dev->dev.kobj, &dev->kobj,
+		pn = sysfs_create_link(&acpi_dev->dev.kobj, &dev->kobj,
 				"physical_node");
+		if (fn || pn) {
+			dev_warn(&acpi_dev->dev,
+				"Failed to create link(s) to %s %s:"
+				" %d\n",
+				dev_driver_string(dev), dev_name(dev),
+				fn ?: pn);
+				return AE_ERROR;
+		}
 		if (acpi_dev->wakeup.flags.valid) {
 			device_set_wakeup_capable(dev, true);
 			device_set_wakeup_enable(dev,

-- 1.7.1.rc1.21.gf3bd6

Justin P. Mattock

maintainer
#24 lore raw

Re: [PATCH 3/5]acpi:glue.c Fix warning: variable 'ret' set but not used

Quoted 3 lines · Justin P. Mattock

a bit confused with the whole: "?:" though
*condition ? value if true : value if false* (what if both are true what if both are false or does it matter?)

If you say:

cond ?: false_value

then you'll get cond if cond is non-zero and false_value if it isn't.

I suspect it's a gccism.

David

#25 lore raw

Re: [PATCH 3/5]acpi:glue.c Fix warning: variable 'ret' set but not used

Quoted 8 lines · David Howells
Quoted 3 lines · Justin P. Mattock

a bit confused with the whole: "?:" though
*condition ? value if true : value if false* (what if both are true what if both are false or does it matter?)

If you say:

Quoted 8 lines

cond ?: false_value

then you'll get cond if cond is non-zero and false_value if it isn't.

I suspect it's a gccism.

David

I'll have to experiment with this one..
?:

Justin P. Mattock