Re: [PATCH 2/5] um: port: Delete three error messages for a failed memory allocation

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

 



>> +++ b/arch/um/drivers/port_kern.c
>> @@ -87,11 +87,8 @@ static int port_accept(struct port_list *port)
>>  	}
>>  
>>  	conn = kmalloc(sizeof(*conn), GFP_ATOMIC);
>> -	if (conn == NULL) {
>> -		printk(KERN_ERR "port_accept : failed to allocate "
>> -		       "connection\n");
>> +	if (!conn)
>>  		goto out_close;
>> -	}
>>  	*conn = ((struct connection)
>>  		{ .list 	= LIST_HEAD_INIT(conn->list),
>>  		  .fd 		= fd,
> 
> I don't see how this eliminates a possible error.

The suggested change affects three coding style issues at this place.

* Repetition of an out-of-memory message

  See also:
  http://events.linuxfoundation.org/sites/events/files/slides/LCJ16-Refactor_Strings-WSang_0.pdf

* Unwanted splitting of a message string

* Usage of a specific preprocessor symbol


> !x is something you use with something that is conceptually a Boolean.

Pointers can be also treated in this way, can't they?

Regards,
Markus
--
To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Kernel Development]     [Kernel Announce]     [Kernel Newbies]     [Linux Networking Development]     [Share Photos]     [IDE]     [Security]     [Git]     [Netfilter]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Device Mapper]

  Powered by Linux