diff mbox series

macintosh: macio-adb: Fix warning comparing pointer to 0

Message ID 1647484201-11738-1-git-send-email-baihaowen@meizu.com (mailing list archive)
State Changes Requested
Headers show
Series macintosh: macio-adb: Fix warning comparing pointer to 0 | expand

Commit Message

Haowen Bai March 17, 2022, 2:30 a.m. UTC
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(-)

Comments

Christophe Leroy March 17, 2022, 8:54 a.m. UTC | #1
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]);
Haowen Bai March 17, 2022, 9:25 a.m. UTC | #2
Sorry, That's my fault. I've sent again.
diff mbox series

Patch

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]);