[PATCH] mptlan.c: fixed UNNECESSARY_CASTS warning

Vinesh Raut vineshraut2017 at gmail.com
Thu Aug 5 11:12:07 UTC 2021


multiple UNNECESSARY_CASTS warnings fixed from mptlan.c
It is not good practice to cast alloc function as it may hide the bugs.

Suggested-by: Lukas Bulwahn <lukas.bulwahn at gmail.com>
Signed-off-by: Vinesh Raut <vineshraut2017 at gmail.com>
---
 drivers/message/fusion/mptlan.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/message/fusion/mptlan.c b/drivers/message/fusion/mptlan.c
index 3261cac762de..f45e7a25e7c3 100644
--- a/drivers/message/fusion/mptlan.c
+++ b/drivers/message/fusion/mptlan.c
@@ -860,7 +860,7 @@ mpt_lan_receive_post_turbo(struct net_device *dev, u32 tmsg)
 	if (len < MPT_LAN_RX_COPYBREAK) {
 		old_skb = skb;
 
-		skb = (struct sk_buff *)dev_alloc_skb(len);
+		skb = dev_alloc_skb(len);
 		if (!skb) {
 			printk (KERN_ERR MYNAM ": %s/%s: ERROR - Can't allocate skb! (%s@%d)\n",
 					IOC_AND_NETDEV_NAMES_s_s(dev),
@@ -1006,7 +1006,7 @@ mpt_lan_receive_post_reply(struct net_device *dev,
 //			"for single packet, concatenating...\n",
 //				IOC_AND_NETDEV_NAMES_s_s(dev)));
 
-		skb = (struct sk_buff *)dev_alloc_skb(len);
+		skb = dev_alloc_skb(len);
 		if (!skb) {
 			printk (KERN_ERR MYNAM ": %s/%s: ERROR - Can't allocate skb! (%s@%d)\n",
 					IOC_AND_NETDEV_NAMES_s_s(dev),
@@ -1048,7 +1048,7 @@ mpt_lan_receive_post_reply(struct net_device *dev,
 
 		old_skb = skb;
 
-		skb = (struct sk_buff *)dev_alloc_skb(len);
+		skb = dev_alloc_skb(len);
 		if (!skb) {
 			printk (KERN_ERR MYNAM ": %s/%s: ERROR - Can't allocate skb! (%s@%d)\n",
 					IOC_AND_NETDEV_NAMES_s_s(dev),
-- 
2.30.2



More information about the Linux-kernel-mentees mailing list