RE: Question regarding strange-looking code in drivers/isdn/i4l/isdn_ppp.c

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> -----Original Message-----
> From: kernelnewbies-bounces@xxxxxxxxxxxxxxxxx [mailto:kernelnewbies-
> bounces@xxxxxxxxxxxxxxxxx] On Behalf Of Bas Peters
> Sent: Monday, February 02, 2015 11:26 AM
> To: kernelnewbies@xxxxxxxxxxxxxxxxx; isdn@xxxxxxxxxxxxxx
> Subject: Question regarding strange-looking code in drivers/isdn/i4l/isdn_ppp.c
> 
> Hi,
> 
> I was checking some code in drivers/isdn/isdn_pp and came across the
> following:
> 
> 	case PPP_VJC_COMP:
> 		if (is->debug & 0x20)
> 			printk(KERN_DEBUG "isdn_ppp: VJC_COMP\n");
> 		{
> 			struct sk_buff *skb_old = skb;
> 			int pkt_len;
> 			skb = dev_alloc_skb(skb_old->len + 128);
> 
> 			if (!skb) {
> 				printk(KERN_WARNING "%s: Memory squeeze,
> dropping packet.\n", dev->name);
> 				skb = skb_old;
> 				goto drop_packet;
> 			}
> 			skb_put(skb, skb_old->len + 128);
> 			skb_copy_from_linear_data(skb_old, skb->data,
> 						  skb_old->len);
> 			if (net_dev->local->ppp_slot < 0) {
> 				printk(KERN_ERR "%s: net_dev->local-
> >ppp_slot(%d) out of range\n",
> 				       __func__, net_dev->local->ppp_slot);
> 				goto drop_packet;
> 			}
> 			pkt_len = slhc_uncompress(ippp_table[net_dev->local-
> >ppp_slot]->slcomp,
> 						  skb->data, skb_old->len);
> 			kfree_skb(skb_old);
> 			if (pkt_len < 0)
> 				goto drop_packet;
> 
> 			skb_trim(skb, pkt_len);
> 			skb->protocol = htons(ETH_P_IP);
> 		}
> 		break;
> 
> Could you explain to me why there are braces AFTER the printk invocation?
> Was it perhaps intended that the printk was included in the braces?
> 
> I'm sorry if I'm missing something completely obvious here, but it seems kind of
> strange to me.
> 
> With kind regards,
> 
> Bas

I assume it's just to introduce a new name space scope inside the case statement without going to the trouble of writing a new function that would be called from it.

Jeff Haran


_______________________________________________
Kernelnewbies mailing list
Kernelnewbies@xxxxxxxxxxxxxxxxx
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies




[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux