From: SF Markus Elfring <elfring@users.sourceforge.net>
To: linux-hams@vger.kernel.org, netdev@vger.kernel.org,
"David S. Miller" <davem@davemloft.net>,
Javier Martinez Canillas <javier@osg.samsung.com>,
Jean-Paul Roubelat <jpr@f6fbb.org>
Cc: LKML <linux-kernel@vger.kernel.org>, kernel-janitors@vger.kernel.org
Subject: [PATCH 2/4] hamradio: Adjust four function calls together with a variable assignment
Date: Tue, 9 May 2017 16:23:20 +0200 [thread overview]
Message-ID: <28005de5-baf6-9db0-7eaa-7ef14d4e7142@users.sourceforge.net> (raw)
In-Reply-To: <4c5c939a-bd55-7b88-8e41-49f5544b7658@users.sourceforge.net>
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
next prev parent reply other threads:[~2017-05-09 14:23 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
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 ` SF Markus Elfring [this message]
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=28005de5-baf6-9db0-7eaa-7ef14d4e7142@users.sourceforge.net \
--to=elfring@users.sourceforge.net \
--cc=davem@davemloft.net \
--cc=javier@osg.samsung.com \
--cc=jpr@f6fbb.org \
--cc=kernel-janitors@vger.kernel.org \
--cc=linux-hams@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).