linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] macintosh: macio-adb: Fix warning comparing pointer to 0
@ 2022-03-17  2:30 Haowen Bai
  2022-03-17  8:54 ` Christophe Leroy
  0 siblings, 1 reply; 5+ messages in thread
From: Haowen Bai @ 2022-03-17  2:30 UTC (permalink / raw)
  To: benh, masahiroy, adobriyan; +Cc: linuxppc-dev, linux-kernel, Haowen Bai

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

Signed-off-by: Haowen Bai <baihaowen@meizu.com>
---
 drivers/macintosh/macio-adb.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/macintosh/macio-adb.c b/drivers/macintosh/macio-adb.c
index dc634c2..51afa46 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,7 @@ 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


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

* Re: [PATCH] macintosh: macio-adb: Fix warning comparing pointer to 0
  2022-03-17  2:30 [PATCH] macintosh: macio-adb: Fix warning comparing pointer to 0 Haowen Bai
@ 2022-03-17  8:54 ` Christophe Leroy
  2022-03-17  9:25   ` 答复: " 白浩文
  0 siblings, 1 reply; 5+ messages in thread
From: Christophe Leroy @ 2022-03-17  8:54 UTC (permalink / raw)
  To: Haowen Bai, benh, masahiroy, adobriyan; +Cc: linuxppc-dev, linux-kernel



Le 17/03/2022 à 03:30, Haowen Bai a écrit :
> Avoid pointer type value compared with 0 to make code clear.
> 
> Signed-off-by: Haowen Bai <baihaowen@meizu.com>

This patch doesn't apply:

Applying patch #1606366 using "git am -s -3 -m"
Description: macintosh: macio-adb: Fix warning comparing pointer to 0
Applying: macintosh: macio-adb: Fix warning comparing pointer to 0
error: corrupt patch at line 37
error: could not build fake ancestor
Patch failed at 0001 macintosh: macio-adb: Fix warning comparing pointer 
to 0
hint: Use 'git am --show-current-patch=diff' to see the failed patch
When you have resolved this problem, run "git am --continue".
If you prefer to skip this patch, run "git am --skip" instead.
To restore the original branch and stop patching, run "git am --abort".
'git am' failed with exit status 128



> ---
>   drivers/macintosh/macio-adb.c | 6 +++---
>   1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/macintosh/macio-adb.c b/drivers/macintosh/macio-adb.c
> index dc634c2..51afa46 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,7 @@ 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]);

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

* 答复: [PATCH] macintosh: macio-adb: Fix warning comparing pointer to 0
  2022-03-17  8:54 ` Christophe Leroy
@ 2022-03-17  9:25   ` 白浩文
  0 siblings, 0 replies; 5+ messages in thread
From: 白浩文 @ 2022-03-17  9:25 UTC (permalink / raw)
  To: Christophe Leroy, benh, masahiroy, adobriyan; +Cc: linuxppc-dev, linux-kernel

Sorry, That's my fault. I've sent again.
________________________________________
发件人: Christophe Leroy <christophe.leroy@csgroup.eu>
发送时间: 2022年3月17日 16:54:16
收件人: 白浩文; benh@kernel.crashing.org; masahiroy@kernel.org; adobriyan@gmail.com
抄送: linuxppc-dev@lists.ozlabs.org; linux-kernel@vger.kernel.org
主题: Re: [PATCH] macintosh: macio-adb: Fix warning comparing pointer to 0

Le 17/03/2022 à 03:30, Haowen Bai a écrit :
> Avoid pointer type value compared with 0 to make code clear.
>
> Signed-off-by: Haowen Bai <baihaowen@meizu.com>

This patch doesn't apply:

Applying patch #1606366 using "git am -s -3 -m"
Description: macintosh: macio-adb: Fix warning comparing pointer to 0
Applying: macintosh: macio-adb: Fix warning comparing pointer to 0
error: corrupt patch at line 37
error: could not build fake ancestor
Patch failed at 0001 macintosh: macio-adb: Fix warning comparing pointer
to 0
hint: Use 'git am --show-current-patch=diff' to see the failed patch
When you have resolved this problem, run "git am --continue".
If you prefer to skip this patch, run "git am --skip" instead.
To restore the original branch and stop patching, run "git am --abort".
'git am' failed with exit status 128



> ---
>   drivers/macintosh/macio-adb.c | 6 +++---
>   1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/macintosh/macio-adb.c b/drivers/macintosh/macio-adb.c
> index dc634c2..51afa46 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,7 @@ 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]);

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

* Re: [PATCH] macintosh: macio-adb: Fix warning comparing pointer to 0
  2022-03-17  9:24 Haowen Bai
@ 2022-11-30  9:23 ` Michael Ellerman
  0 siblings, 0 replies; 5+ messages in thread
From: Michael Ellerman @ 2022-11-30  9:23 UTC (permalink / raw)
  To: Haowen Bai, masahiroy, benh, adobriyan; +Cc: linux-kernel, linuxppc-dev

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

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

* [PATCH] macintosh: macio-adb: Fix warning comparing pointer to 0
@ 2022-03-17  9:24 Haowen Bai
  2022-11-30  9:23 ` Michael Ellerman
  0 siblings, 1 reply; 5+ messages in thread
From: Haowen Bai @ 2022-03-17  9:24 UTC (permalink / raw)
  To: benh, masahiroy, adobriyan; +Cc: linuxppc-dev, linux-kernel, Haowen Bai

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

Signed-off-by: Haowen Bai <baihaowen@meizu.com>
---
 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


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

end of thread, other threads:[~2022-11-30  9:31 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-03-17  2:30 [PATCH] macintosh: macio-adb: Fix warning comparing pointer to 0 Haowen Bai
2022-03-17  8:54 ` Christophe Leroy
2022-03-17  9:25   ` 答复: " 白浩文
2022-03-17  9:24 Haowen Bai
2022-11-30  9:23 ` Michael Ellerman

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).