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

Jeff Dike
2017-01-19T00:07:48Z

> --- a/arch/um/drivers/port_kern.c
> +++ 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. It should behave
exactly the same. To me, this is an expressiveness issue.

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

x = NULL is a question about a pointer, which is the case here.

Jeff
--
Jeff Dike
AddToIt
978-254-0789 (o)
978-394-8986 (c)