linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2] hdlcdrv: replace unnecessary assertion in hdlcdrv_register
@ 2019-12-17 21:06 Aditya Pakki
  2019-12-17 21:27 ` Markus Elfring
  2019-12-20  1:34 ` David Miller
  0 siblings, 2 replies; 3+ messages in thread
From: Aditya Pakki @ 2019-12-17 21:06 UTC (permalink / raw)
  To: pakki001
  Cc: kjlu, David S. Miller, Thomas Gleixner, Markus Elfring,
	Greg Kroah-Hartman, Kate Stewart, netdev, linux-kernel

In hdlcdrv_register, failure to register the driver causes a crash.
The three callers of hdlcdrv_register all pass valid pointers and
do not fail. The patch eliminates the unnecessary BUG_ON assertion.

Signed-off-by: Aditya Pakki <pakki001@umn.edu>
---
v1: Changed from returning -EINVAL to deleting BUG_ON as identified
by Stephen Hemminger.
---
 drivers/net/hamradio/hdlcdrv.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/net/hamradio/hdlcdrv.c b/drivers/net/hamradio/hdlcdrv.c
index df495b5595f5..e7413a643929 100644
--- a/drivers/net/hamradio/hdlcdrv.c
+++ b/drivers/net/hamradio/hdlcdrv.c
@@ -687,8 +687,6 @@ struct net_device *hdlcdrv_register(const struct hdlcdrv_ops *ops,
 	struct hdlcdrv_state *s;
 	int err;
 
-	BUG_ON(ops == NULL);
-
 	if (privsize < sizeof(struct hdlcdrv_state))
 		privsize = sizeof(struct hdlcdrv_state);
 
-- 
2.20.1


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

* Re: [PATCH v2] hdlcdrv: replace unnecessary assertion in hdlcdrv_register
  2019-12-17 21:06 [PATCH v2] hdlcdrv: replace unnecessary assertion in hdlcdrv_register Aditya Pakki
@ 2019-12-17 21:27 ` Markus Elfring
  2019-12-20  1:34 ` David Miller
  1 sibling, 0 replies; 3+ messages in thread
From: Markus Elfring @ 2019-12-17 21:27 UTC (permalink / raw)
  To: Aditya Pakki, netdev
  Cc: Kangjie Lu, David S. Miller, Thomas Gleixner, Greg Kroah-Hartman,
	Kate Stewart, linux-kernel

> The three callers of hdlcdrv_register all pass valid pointers and
> do not fail. The patch eliminates the unnecessary BUG_ON assertion.

I suggest to replace the wording “The patch eliminates” by “Thus delete”
to make it imperative as desired.

Will the tag “Fixes” be added to the final change description?


> ---
>  drivers/net/hamradio/hdlcdrv.c | 2 --

Please replace these triple dashes by a blank line.

Regards,
Markus

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

* Re: [PATCH v2] hdlcdrv: replace unnecessary assertion in hdlcdrv_register
  2019-12-17 21:06 [PATCH v2] hdlcdrv: replace unnecessary assertion in hdlcdrv_register Aditya Pakki
  2019-12-17 21:27 ` Markus Elfring
@ 2019-12-20  1:34 ` David Miller
  1 sibling, 0 replies; 3+ messages in thread
From: David Miller @ 2019-12-20  1:34 UTC (permalink / raw)
  To: pakki001; +Cc: kjlu, tglx, elfring, gregkh, kstewart, netdev, linux-kernel

From: Aditya Pakki <pakki001@umn.edu>
Date: Tue, 17 Dec 2019 15:06:19 -0600

> In hdlcdrv_register, failure to register the driver causes a crash.
> The three callers of hdlcdrv_register all pass valid pointers and
> do not fail. The patch eliminates the unnecessary BUG_ON assertion.
> 
> Signed-off-by: Aditya Pakki <pakki001@umn.edu>

Applied to net-next.

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

end of thread, other threads:[~2019-12-20  1:34 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-12-17 21:06 [PATCH v2] hdlcdrv: replace unnecessary assertion in hdlcdrv_register Aditya Pakki
2019-12-17 21:27 ` Markus Elfring
2019-12-20  1:34 ` David Miller

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