Skip to contentSkip to conversation

watchdog: machzwd : fix warning Using plain integer as NULL pointer

PATCH In review Hariprasad Kelam 3 participants 3 messages Apr 6, 2019 Watchdog device drivers

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 watchdog: machzwd : fix warning Using plain integer as NULL pointer

Changes passing function argument 0 to NULL to avoid below sparse warning

CHECK drivers/watchdog//machzwd.c
drivers/watchdog//machzwd.c:321:25: warning: Using plain integer as NULL pointer

---
 drivers/watchdog/machzwd.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/watchdog/machzwd.c +1 -1
index 88d823d..c3926d0 100644
@@ -318,7 +318,7 @@ static long zf_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
 	case WDIOC_GETBOOTSTATUS:
 		return put_user(0, p);
 	case WDIOC_KEEPALIVE:
-		zf_ping(0);
+		zf_ping(NULL);
 		break;
 	default:
 		return -ENOTTY;
Signature · 1 line
2.7.4
Reviewed-by on v1 1/1
#1 lore raw
Quoted 7 lines · Hariprasad Kelam

Changes passing function argument 0 to NULL to avoid below sparse warning

CHECK drivers/watchdog//machzwd.c
drivers/watchdog//machzwd.c:321:25: warning: Using plain integer as NULL pointer

Cheers,
-Mukesh

Quoted 17 lines
---
  drivers/watchdog/machzwd.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
drivers/watchdog/machzwd.c +1 -1
index 88d823d..c3926d0 100644
@@ -318,7 +318,7 @@ static long zf_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
  	case WDIOC_GETBOOTSTATUS:
  		return put_user(0, p);
  	case WDIOC_KEEPALIVE:
-		zf_ping(0);
+		zf_ping(NULL);
  		break;
  	default:
  		return -ENOTTY;
maintainer Reviewed-by on v1 1/1
#2 lore raw
In reply to Hariprasad Kelam
Quoted 8 lines · Hariprasad Kelam

Changes passing function argument 0 to NULL to avoid below sparse warning

CHECK drivers/watchdog//machzwd.c
drivers/watchdog//machzwd.c:321:25: warning: Using plain integer as NULL pointer

[reluctantly]

If anyone is still using the HW supported by this driver, it would be a prime target for conversion to use the watchdog subsystem. This would reduce code size and improve driver stability. _That_ would be useful.

The only reason for replacing 0 with NULL is to make a static checker happy. This kind of change adds zero value to the code. Instead, it takes time from those who have to review the patches and apply them.

If we ignore such patches, we'll get them again and again, taking away even more time. If we don't ignore them, we encourage submitters and get even more useless patches. If we try to discourage them, we risk being accused of being unfriendly. This is a perfect lose-lose situation for maintainers.

Guenter

Quoted 18 lines
---
  drivers/watchdog/machzwd.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
drivers/watchdog/machzwd.c +1 -1
index 88d823d..c3926d0 100644
@@ -318,7 +318,7 @@ static long zf_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
  	case WDIOC_GETBOOTSTATUS:
  		return put_user(0, p);
  	case WDIOC_KEEPALIVE:
-		zf_ping(0);
+		zf_ping(NULL);
  		break;
  	default:
  		return -ENOTTY;