[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20170119000748.GB12052@parts.user-mode-linux.org>
Date: Wed, 18 Jan 2017 19:07:48 -0500
From: Jeff Dike <jdike@...toit.com>
To: SF Markus Elfring <elfring@...rs.sourceforge.net>
Cc: user-mode-linux-devel@...ts.sourceforge.net,
user-mode-linux-user@...ts.sourceforge.net,
Anton Ivanov <aivanov@...-begemot.co.uk>,
Dan Williams <dan.j.williams@...el.com>,
Hannes Reinecke <hare@...e.com>, Jens Axboe <axboe@...com>,
Richard Weinberger <richard@....at>,
LKML <linux-kernel@...r.kernel.org>,
kernel-janitors@...r.kernel.org, Wolfram Sang <wsa@...-dreams.de>
Subject: Re: [PATCH 2/5] um: port: Delete three error messages for a failed
memory allocation
> --- 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)
Powered by blists - more mailing lists