[PATCH] macintosh: macio-adb: Fix warning comparing pointer to 0

Subsystems: linux for power macintosh, the rest

STALE1379d LANDED

Landed in mainline as fc21ed8f26d9 on 2022-11-24.

2 messages, 2 authors, 2022-11-30 · open the first message on its own page

[PATCH] macintosh: macio-adb: Fix warning comparing pointer to 0

From: Haowen Bai <hidden>
Date: 2022-03-17 09:24:58

Avoid pointer type value compared with 0 to make code clear.

Signed-off-by: Haowen Bai <redacted>
---
 drivers/macintosh/macio-adb.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/drivers/macintosh/macio-adb.c b/drivers/macintosh/macio-adb.c
index dc634c2..b7d287a 100644
--- a/drivers/macintosh/macio-adb.c
+++ b/drivers/macintosh/macio-adb.c
@@ -97,7 +97,7 @@ int macio_init(void)
 	unsigned int irq;
 
 	adbs = of_find_compatible_node(NULL, "adb", "chrp,adb0");
-	if (adbs == 0)
+	if (!adbs)
 		return -ENXIO;
 
 	if (of_address_to_resource(adbs, 0, &r)) {
@@ -180,7 +180,7 @@ static int macio_send_request(struct adb_request *req, int sync)
 	req->reply_len = 0;
 
 	spin_lock_irqsave(&macio_lock, flags);
-	if (current_req != 0) {
+	if (current_req) {
 		last_req->next = req;
 		last_req = req;
 	} else {
@@ -210,7 +210,8 @@ static irqreturn_t macio_adb_interrupt(int irq, void *arg)
 	spin_lock(&macio_lock);
 	if (in_8(&adb->intr.r) & TAG) {
 		handled = 1;
-		if ((req = current_req) != 0) {
+		req = current_req;
+		if (req) {
 			/* put the current request in */
 			for (i = 0; i < req->nbytes; ++i)
 				out_8(&adb->data[i].r, req->data[i]);
-- 
2.7.4

Re: [PATCH] macintosh: macio-adb: Fix warning comparing pointer to 0

From: Michael Ellerman <hidden>
Date: 2022-11-30 09:31:33

On Thu, 17 Mar 2022 17:24:49 +0800, Haowen Bai wrote:
Avoid pointer type value compared with 0 to make code clear.
Applied to powerpc/next.

[1/1] macintosh: macio-adb: Fix warning comparing pointer to 0
      https://git.kernel.org/powerpc/c/fc21ed8f26d980428f9b4e08e0fb72c7f7ffc9b8

cheers
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help