Skip to contentSkip to conversation

power: Fix typo in status comparison causing warning

PATCH In review Kevin Winchester 3 participants 5 messages Oct 29, 2010

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 power: Fix typo in status comparison causing warning

GCC version 4.5.1 gives the following warning:

drivers/base/power/runtime.c: In function ‘rpm_check_suspend_allowed’:
drivers/base/power/runtime.c:146:25: warning: comparison between ‘enum dpm_state’ and ‘enum rpm_status’

which seems to be a typo in that dev->power.runtime_status should be compared instead of dev->power.status.

---
 drivers/base/power/runtime.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/base/power/runtime.c +1 -1
index 126ca49..02c652b 100644
@@ -143,7 +143,7 @@ static int rpm_check_suspend_allowed(struct device *dev)
 
 	/* Pending resume requests take precedence over suspends. */
 	else if ((dev->power.deferred_resume
-			&& dev->power.status == RPM_SUSPENDING)
+			&& dev->power.runtime_status == RPM_SUSPENDING)
 	    || (dev->power.request_pending
 			&& dev->power.request == RPM_REQ_RESUME))
 		retval = -EAGAIN;
Signature · 1 line
1.7.3.2
#1 lore raw
Quoted 18 lines · Kevin Winchester

GCC version 4.5.1 gives the following warning:

drivers/base/power/runtime.c: In function ‘rpm_check_suspend_allowed’:
drivers/base/power/runtime.c:146:25: warning: comparison between ‘enum dpm_state’ and ‘enum rpm_status’

which seems to be a typo in that dev->power.runtime_status should be compared instead of dev->power.status.

---
 drivers/base/power/runtime.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/base/power/runtime.c +0 -0
index 126ca49..02c652b 100644

drivers/base/power/runtime.c static int rpm_check_suspend_allowed(struct device *dev) · line 149

Quoted 8 lines
drivers/base/power/runtime.c +1 -1
@@ -143,7 +143,7 @@ static int rpm_check_suspend_allowed(struct device *dev)
 
 	/* Pending resume requests take precedence over suspends. */
 	else if ((dev->power.deferred_resume
-			&& dev->power.status == RPM_SUSPENDING)
+			&& dev->power.runtime_status == RPM_SUSPENDING)
 	    || (dev->power.request_pending
 			&& dev->power.request == RPM_REQ_RESUME))
 		retval = -EAGAIN;

Ouch, this actually is a serious bug.

Thanks a lot for the fix, will push to Linus shortly.

Rafael

_______________________________________________
linux-pm mailing list
[email protected]
https://lists.linux-foundation.org/mailman/listinfo/linux-pm

#2 lore raw
In reply to Kevin Winchester
Quoted 18 lines · Kevin Winchester

GCC version 4.5.1 gives the following warning:

drivers/base/power/runtime.c: In function ‘rpm_check_suspend_allowed’:
drivers/base/power/runtime.c:146:25: warning: comparison between ‘enum dpm_state’ and ‘enum rpm_status’

which seems to be a typo in that dev->power.runtime_status should be compared instead of dev->power.status.

---
 drivers/base/power/runtime.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/base/power/runtime.c +0 -0
index 126ca49..02c652b 100644

drivers/base/power/runtime.c static int rpm_check_suspend_allowed(struct device *dev) · line 149

Quoted 8 lines
drivers/base/power/runtime.c +1 -1
@@ -143,7 +143,7 @@ static int rpm_check_suspend_allowed(struct device *dev)
 
 	/* Pending resume requests take precedence over suspends. */
 	else if ((dev->power.deferred_resume
-			&& dev->power.status == RPM_SUSPENDING)
+			&& dev->power.runtime_status == RPM_SUSPENDING)
 	    || (dev->power.request_pending
 			&& dev->power.request == RPM_REQ_RESUME))
 		retval = -EAGAIN;

Ouch, this actually is a serious bug.

Thanks a lot for the fix, will push to Linus shortly.

Rafael

#3 lore raw
Quoted 20 lines · Rafael J. Wysocki
Quoted 19 lines · Kevin Winchester

GCC version 4.5.1 gives the following warning:

drivers/base/power/runtime.c: In function ‘rpm_check_suspend_allowed’:
drivers/base/power/runtime.c:146:25: warning: comparison between ‘enum dpm_state’ and ‘enum rpm_status’

which seems to be a typo in that dev->power.runtime_status should be compared instead of dev->power.status.

---
 drivers/base/power/runtime.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/base/power/runtime.c +0 -0
index 126ca49..02c652b 100644
@@ -143,7 +143,7 @@ static int rpm_check_suspend_allowed(struct device *dev)
 
Quoted 9 lines

drivers/base/power/runtime.c static int rpm_check_suspend_allowed(struct device *dev) · line 149

Quoted 7 lines
drivers/base/power/runtime.c +1 -1
 	/* Pending resume requests take precedence over suspends. */
 	else if ((dev->power.deferred_resume
-			&& dev->power.status == RPM_SUSPENDING)
+			&& dev->power.runtime_status == RPM_SUSPENDING)
 	    || (dev->power.request_pending
 			&& dev->power.request == RPM_REQ_RESUME))
 		retval = -EAGAIN;

Ouch, this actually is a serious bug.

Yes indeed. I should have caught it while reviewing the patch. A quick check shows there are no other similar typos.

Quoted 3 lines

Thanks a lot for the fix, will push to Linus shortly.

Rafael

Alan Stern

#4 lore raw
In reply to Rafael J. Wysocki
Quoted 20 lines · Rafael J. Wysocki
Quoted 19 lines · Kevin Winchester

GCC version 4.5.1 gives the following warning:

drivers/base/power/runtime.c: In function ‘rpm_check_suspend_allowed’:
drivers/base/power/runtime.c:146:25: warning: comparison between ‘enum dpm_state’ and ‘enum rpm_status’

which seems to be a typo in that dev->power.runtime_status should be compared instead of dev->power.status.

---
 drivers/base/power/runtime.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/base/power/runtime.c +0 -0
index 126ca49..02c652b 100644
@@ -143,7 +143,7 @@ static int rpm_check_suspend_allowed(struct device *dev)
 
Quoted 9 lines

drivers/base/power/runtime.c static int rpm_check_suspend_allowed(struct device *dev) · line 149

Quoted 7 lines
drivers/base/power/runtime.c +1 -1
 	/* Pending resume requests take precedence over suspends. */
 	else if ((dev->power.deferred_resume
-			&& dev->power.status == RPM_SUSPENDING)
+			&& dev->power.runtime_status == RPM_SUSPENDING)
 	    || (dev->power.request_pending
 			&& dev->power.request == RPM_REQ_RESUME))
 		retval = -EAGAIN;

Ouch, this actually is a serious bug.

Yes indeed. I should have caught it while reviewing the patch. A quick check shows there are no other similar typos.

Quoted 3 lines

Thanks a lot for the fix, will push to Linus shortly.

Rafael

Alan Stern