linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/4] hamradio: Fine-tuning for nine function implementations
@ 2017-05-09 14:21 SF Markus Elfring
  2017-05-09 14:22 ` [PATCH 1/4] hamradio: Combine two seq_printf() calls into one in yam_seq_show() SF Markus Elfring
                   ` (4 more replies)
  0 siblings, 5 replies; 7+ messages in thread
From: SF Markus Elfring @ 2017-05-09 14:21 UTC (permalink / raw)
  To: linux-hams, netdev, David S. Miller, Javier Martinez Canillas,
	Jean-Paul Roubelat
  Cc: LKML, kernel-janitors

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Tue, 9 May 2017 16:11:23 +0200

A few update suggestions were taken into account
from static source code analysis.

Markus Elfring (4):
  Combine two seq_printf() calls into one in yam_seq_show()
  Adjust four function calls together with a variable assignment
  Use seq_puts() in bpq_seq_show()
  Adjust four function calls together with a variable assignment

 drivers/net/hamradio/bpqether.c | 14 +++++++++-----
 drivers/net/hamradio/yam.c      | 15 +++++++++------
 2 files changed, 18 insertions(+), 11 deletions(-)

-- 
2.12.2

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

* [PATCH 1/4] hamradio: Combine two seq_printf() calls into one in yam_seq_show()
  2017-05-09 14:21 [PATCH 0/4] hamradio: Fine-tuning for nine function implementations SF Markus Elfring
@ 2017-05-09 14:22 ` SF Markus Elfring
  2017-05-10  8:48   ` David Laight
  2017-05-09 14:23 ` [PATCH 2/4] hamradio: Adjust four function calls together with a variable assignment SF Markus Elfring
                   ` (3 subsequent siblings)
  4 siblings, 1 reply; 7+ messages in thread
From: SF Markus Elfring @ 2017-05-09 14:22 UTC (permalink / raw)
  To: linux-hams, netdev, David S. Miller, Javier Martinez Canillas,
	Jean-Paul Roubelat
  Cc: LKML, kernel-janitors

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Tue, 9 May 2017 14:16:45 +0200

A bit of data was put into a sequence by two separate function calls.
Print the same data by a single function call instead.

This issue was detected by using the Coccinelle software.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
 drivers/net/hamradio/yam.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/net/hamradio/yam.c b/drivers/net/hamradio/yam.c
index b6891ada1d7b..542f1e511df1 100644
--- a/drivers/net/hamradio/yam.c
+++ b/drivers/net/hamradio/yam.c
@@ -830,8 +830,7 @@ static int yam_seq_show(struct seq_file *seq, void *v)
 	seq_printf(seq, "  RxFrames %lu\n", dev->stats.rx_packets);
 	seq_printf(seq, "  TxInt    %u\n", yp->nb_mdint);
 	seq_printf(seq, "  RxInt    %u\n", yp->nb_rxint);
-	seq_printf(seq, "  RxOver   %lu\n", dev->stats.rx_fifo_errors);
-	seq_printf(seq, "\n");
+	seq_printf(seq, "  RxOver   %lu\n\n", dev->stats.rx_fifo_errors);
 	return 0;
 }
 
-- 
2.12.2

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

* [PATCH 2/4] hamradio: Adjust four function calls together with a variable assignment
  2017-05-09 14:21 [PATCH 0/4] hamradio: Fine-tuning for nine function implementations SF Markus Elfring
  2017-05-09 14:22 ` [PATCH 1/4] hamradio: Combine two seq_printf() calls into one in yam_seq_show() SF Markus Elfring
@ 2017-05-09 14:23 ` SF Markus Elfring
  2017-05-09 14:24 ` [PATCH 3/4] hamradio: Use seq_puts() in bpq_seq_show() SF Markus Elfring
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 7+ messages in thread
From: SF Markus Elfring @ 2017-05-09 14:23 UTC (permalink / raw)
  To: linux-hams, netdev, David S. Miller, Javier Martinez Canillas,
	Jean-Paul Roubelat
  Cc: LKML, kernel-janitors

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Tue, 9 May 2017 15:15:16 +0200

The script "checkpatch.pl" pointed information out like the following.

ERROR: do not use assignment in if condition

Thus fix affected source code places.
Improve a size determination.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
 drivers/net/hamradio/yam.c | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/drivers/net/hamradio/yam.c b/drivers/net/hamradio/yam.c
index 542f1e511df1..c792b0f116a5 100644
--- a/drivers/net/hamradio/yam.c
+++ b/drivers/net/hamradio/yam.c
@@ -401,7 +401,8 @@ static unsigned char *add_mcs(unsigned char *bits, int bitrate,
 	}
 
 	/* Allocate a new mcs */
-	if ((p = kmalloc(sizeof(struct yam_mcs), GFP_KERNEL)) == NULL) {
+	p = kmalloc(sizeof(*p), GFP_KERNEL);
+	if (!p) {
 		release_firmware(fw);
 		return NULL;
 	}
@@ -549,7 +550,8 @@ static inline void yam_rx_flag(struct net_device *dev, struct yam_port *yp)
 		if ((yp->rx_crch & yp->rx_crcl) != 0xFF) {
 			/* Bad crc */
 		} else {
-			if (!(skb = dev_alloc_skb(pkt_len))) {
+			skb = dev_alloc_skb(pkt_len);
+			if (!skb) {
 				printk(KERN_WARNING "%s: memory squeeze, dropping packet\n", dev->name);
 				++dev->stats.rx_dropped;
 			} else {
@@ -670,7 +672,8 @@ static void yam_tx_byte(struct net_device *dev, struct yam_port *yp)
 		break;
 	case TX_HEAD:
 		if (--yp->tx_count <= 0) {
-			if (!(skb = skb_dequeue(&yp->send_queue))) {
+			skb = skb_dequeue(&yp->send_queue);
+			if (!skb) {
 				ptt_off(dev);
 				yp->tx_state = TX_OFF;
 				break;
@@ -879,7 +882,8 @@ static int yam_open(struct net_device *dev)
 		printk(KERN_ERR "%s: cannot 0x%lx busy\n", dev->name, dev->base_addr);
 		return -EACCES;
 	}
-	if ((u = yam_check_uart(dev->base_addr)) == c_uart_unknown) {
+	u = yam_check_uart(dev->base_addr);
+	if (u == c_uart_unknown) {
 		printk(KERN_ERR "%s: cannot find uart type\n", dev->name);
 		ret = -EIO;
 		goto out_release_base;
-- 
2.12.2

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

* [PATCH 3/4] hamradio: Use seq_puts() in bpq_seq_show()
  2017-05-09 14:21 [PATCH 0/4] hamradio: Fine-tuning for nine function implementations SF Markus Elfring
  2017-05-09 14:22 ` [PATCH 1/4] hamradio: Combine two seq_printf() calls into one in yam_seq_show() SF Markus Elfring
  2017-05-09 14:23 ` [PATCH 2/4] hamradio: Adjust four function calls together with a variable assignment SF Markus Elfring
@ 2017-05-09 14:24 ` SF Markus Elfring
  2017-05-09 14:25 ` [PATCH 4/4] hamradio: Adjust four function calls together with a variable assignment SF Markus Elfring
  2017-05-09 14:43 ` [PATCH 0/4] hamradio: Fine-tuning for nine function implementations David Miller
  4 siblings, 0 replies; 7+ messages in thread
From: SF Markus Elfring @ 2017-05-09 14:24 UTC (permalink / raw)
  To: linux-hams, netdev, David S. Miller, Javier Martinez Canillas,
	Jean-Paul Roubelat
  Cc: LKML, kernel-janitors

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Tue, 9 May 2017 15:45:09 +0200

A string which did not contain a data format specification should be put
into a sequence. Thus use the corresponding function "seq_puts".

This issue was detected by using the Coccinelle software.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
 drivers/net/hamradio/bpqether.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/hamradio/bpqether.c b/drivers/net/hamradio/bpqether.c
index f62e7f325cf9..eaa0f2e8e561 100644
--- a/drivers/net/hamradio/bpqether.c
+++ b/drivers/net/hamradio/bpqether.c
@@ -434,7 +434,7 @@ static int bpq_seq_show(struct seq_file *seq, void *v)
 			bpqdev->dest_addr);
 
 		if (is_multicast_ether_addr(bpqdev->acpt_addr))
-			seq_printf(seq, "*\n");
+			seq_puts(seq, "*\n");
 		else
 			seq_printf(seq, "%pM\n", bpqdev->acpt_addr);
 
-- 
2.12.2

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

* [PATCH 4/4] hamradio: Adjust four function calls together with a variable assignment
  2017-05-09 14:21 [PATCH 0/4] hamradio: Fine-tuning for nine function implementations SF Markus Elfring
                   ` (2 preceding siblings ...)
  2017-05-09 14:24 ` [PATCH 3/4] hamradio: Use seq_puts() in bpq_seq_show() SF Markus Elfring
@ 2017-05-09 14:25 ` SF Markus Elfring
  2017-05-09 14:43 ` [PATCH 0/4] hamradio: Fine-tuning for nine function implementations David Miller
  4 siblings, 0 replies; 7+ messages in thread
From: SF Markus Elfring @ 2017-05-09 14:25 UTC (permalink / raw)
  To: linux-hams, netdev, David S. Miller, Javier Martinez Canillas,
	Jean-Paul Roubelat
  Cc: LKML, kernel-janitors

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Tue, 9 May 2017 15:57:17 +0200

The script "checkpatch.pl" pointed information out like the following.

ERROR: do not use assignment in if condition

Thus fix affected source code places.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
 drivers/net/hamradio/bpqether.c | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/drivers/net/hamradio/bpqether.c b/drivers/net/hamradio/bpqether.c
index eaa0f2e8e561..5e234e0ca256 100644
--- a/drivers/net/hamradio/bpqether.c
+++ b/drivers/net/hamradio/bpqether.c
@@ -185,7 +185,8 @@ static int bpq_rcv(struct sk_buff *skb, struct net_device *dev, struct packet_ty
 	if (!net_eq(dev_net(dev), &init_net))
 		goto drop;
 
-	if ((skb = skb_share_check(skb, GFP_ATOMIC)) == NULL)
+	skb = skb_share_check(skb, GFP_ATOMIC);
+	if (!skb)
 		return NET_RX_DROP;
 
 	if (!pskb_may_pull(skb, sizeof(struct ethhdr)))
@@ -286,7 +287,8 @@ static netdev_tx_t bpq_xmit(struct sk_buff *skb, struct net_device *dev)
 	bpq = netdev_priv(dev);
 
 	orig_dev = dev;
-	if ((dev = bpq_get_ether_dev(dev)) == NULL) {
+	dev = bpq_get_ether_dev(dev);
+	if (!dev) {
 		orig_dev->stats.tx_dropped++;
 		kfree_skb(skb);
 		return NETDEV_TX_OK;
@@ -565,12 +567,14 @@ static int bpq_device_event(struct notifier_block *this,
 		break;
 
 	case NETDEV_DOWN:	/* ethernet device closed -> close BPQ interface */
-		if ((dev = bpq_get_ax25_dev(dev)) != NULL)
+		dev = bpq_get_ax25_dev(dev);
+		if (dev)
 			dev_close(dev);
 		break;
 
 	case NETDEV_UNREGISTER:	/* ethernet device removed -> free BPQ interface */
-		if ((dev = bpq_get_ax25_dev(dev)) != NULL)
+		dev = bpq_get_ax25_dev(dev);
+		if (dev)
 			bpq_free_device(dev);
 		break;
 	default:
-- 
2.12.2

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

* Re: [PATCH 0/4] hamradio: Fine-tuning for nine function implementations
  2017-05-09 14:21 [PATCH 0/4] hamradio: Fine-tuning for nine function implementations SF Markus Elfring
                   ` (3 preceding siblings ...)
  2017-05-09 14:25 ` [PATCH 4/4] hamradio: Adjust four function calls together with a variable assignment SF Markus Elfring
@ 2017-05-09 14:43 ` David Miller
  4 siblings, 0 replies; 7+ messages in thread
From: David Miller @ 2017-05-09 14:43 UTC (permalink / raw)
  To: elfring; +Cc: linux-hams, netdev, javier, jpr, linux-kernel, kernel-janitors


You can feel free to continue submitting these changes, even though
people have asked you to back off on this, and that there is little to
no value to this churn.

But I personally am not going to apply any of your changes...

Especially since you keep posting even though people are asking you to
not make these changes.

You can ignore feedback like that, and you are explicitly being
notified that as a result, we can feel free to ignore you _too_.

People who submit kernel changes in the way you do waste a lot of
people's valuable time which could be spent on fixing real bugs,
implementing new important features, adding new documentation to
improve the understanding of the kernel for everyone, etc.

But instead, that time is being invested to reviewing your extremely
low value patches, many of which are undesirable.

I will not stand for it as the networking maintainer and am going to
ignore everything you submit until your approach and attitude towards
kernel patch submission _fundamentally_ (not temporarily, or for one
specific set of patches) changes.

Thank you.

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

* RE: [PATCH 1/4] hamradio: Combine two seq_printf() calls into one in yam_seq_show()
  2017-05-09 14:22 ` [PATCH 1/4] hamradio: Combine two seq_printf() calls into one in yam_seq_show() SF Markus Elfring
@ 2017-05-10  8:48   ` David Laight
  0 siblings, 0 replies; 7+ messages in thread
From: David Laight @ 2017-05-10  8:48 UTC (permalink / raw)
  To: 'SF Markus Elfring',
	linux-hams, netdev, David S. Miller, Javier Martinez Canillas,
	Jean-Paul Roubelat
  Cc: LKML, kernel-janitors

From: SF Markus Elfring
> Sent: 09 May 2017 15:22
> A bit of data was put into a sequence by two separate function calls.
> Print the same data by a single function call instead.
> 
> This issue was detected by using the Coccinelle software.
> 
> Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
> ---
>  drivers/net/hamradio/yam.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/drivers/net/hamradio/yam.c b/drivers/net/hamradio/yam.c
> index b6891ada1d7b..542f1e511df1 100644
> --- a/drivers/net/hamradio/yam.c
> +++ b/drivers/net/hamradio/yam.c
> @@ -830,8 +830,7 @@ static int yam_seq_show(struct seq_file *seq, void *v)
>  	seq_printf(seq, "  RxFrames %lu\n", dev->stats.rx_packets);
>  	seq_printf(seq, "  TxInt    %u\n", yp->nb_mdint);
>  	seq_printf(seq, "  RxInt    %u\n", yp->nb_rxint);
> -	seq_printf(seq, "  RxOver   %lu\n", dev->stats.rx_fifo_errors);
> -	seq_printf(seq, "\n");
> +	seq_printf(seq, "  RxOver   %lu\n\n", dev->stats.rx_fifo_errors);
>  	return 0;

The code was consistently (and probably deliberately) using one seq_printf()
call for each line so that the source looks 'a bit like' the output.

These changes are all stupid.

	David

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

end of thread, other threads:[~2017-05-10  8:48 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-05-09 14:21 [PATCH 0/4] hamradio: Fine-tuning for nine function implementations SF Markus Elfring
2017-05-09 14:22 ` [PATCH 1/4] hamradio: Combine two seq_printf() calls into one in yam_seq_show() SF Markus Elfring
2017-05-10  8:48   ` David Laight
2017-05-09 14:23 ` [PATCH 2/4] hamradio: Adjust four function calls together with a variable assignment SF Markus Elfring
2017-05-09 14:24 ` [PATCH 3/4] hamradio: Use seq_puts() in bpq_seq_show() SF Markus Elfring
2017-05-09 14:25 ` [PATCH 4/4] hamradio: Adjust four function calls together with a variable assignment SF Markus Elfring
2017-05-09 14:43 ` [PATCH 0/4] hamradio: Fine-tuning for nine function implementations 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).