Linux Input/HID development
 help / color / mirror / Atom feed
From: "Hohndel, Dirk" <hohndel@linux.intel.com>
To: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Cc: Jeff Garzik <jeff@garzik.org>, Jiri Kosina <jikos@jikos.cz>,
	linux-input@atrey.karlin.mff.cuni.cz,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] INPUT: fix hidinput_connect ignoring retval from input_register_device
Date: Mon, 29 Oct 2007 08:38:08 -0700	[thread overview]
Message-ID: <3CE5A712-C0BE-45EE-9171-C3B54F789483@linux.intel.com> (raw)
In-Reply-To: <d120d5000710290833i5ed524d6ne95fc1ef34834566@mail.gmail.com>


On Oct 29, 2007, at 8:33 AM, Dmitry Torokhov wrote:

> On 10/29/07, Dirk Hohndel <hohndel@linux.intel.com> wrote:
>>
>> Actually, the more I look at the code that bails when it runs out  
>> of memory,
>> the more I wonder about that.
>>
>>        hidinput = kzalloc(sizeof(*hidinput), GFP_KERNEL);
>>        input_dev = input_allocate_device();
>>        if (!hidinput || !input_dev) {
>>                kfree(hidinput);
>>                input_free_device(input_dev);
>>
>> This either passes a NULL pointer to kfree or to  
>> input_free_device. That's
>> not nice.
>>
>
> No, that's allright. input_free_device() takes after kfree() so that
> it safe to call it with NULL pointer.

Ahh - should have checked that.

Will the rest of the patch work with the call to hidinput_disconnect?  
If yes then
I'll send a cleaned up version that removes the unnecessary checks in  
the case here...

/D	

  reply	other threads:[~2007-10-29 15:38 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-10-29  6:51 [PATCH] INPUT: fix hidinput_connect ignoring retval from input_register_device Dirk Hohndel
2007-10-29  7:53 ` Jeff Garzik
2007-10-29  8:49   ` Dirk Hohndel
2007-10-29  9:35     ` Jeff Garzik
2007-10-29 10:14     ` Jiri Kosina
2007-10-29 12:54       ` Dmitry Torokhov
2007-10-29 12:57         ` Jiri Kosina
2007-10-29 14:49         ` Jeff Garzik
2007-10-29 15:20           ` Dirk Hohndel
2007-10-29 15:33             ` Dmitry Torokhov
2007-10-29 15:38               ` Hohndel, Dirk [this message]
2007-10-29 17:11                 ` Dmitry Torokhov
2007-10-29 17:28             ` Jiri Kosina
2007-10-29 22:50               ` Dirk Hohndel

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3CE5A712-C0BE-45EE-9171-C3B54F789483@linux.intel.com \
    --to=hohndel@linux.intel.com \
    --cc=dmitry.torokhov@gmail.com \
    --cc=jeff@garzik.org \
    --cc=jikos@jikos.cz \
    --cc=linux-input@atrey.karlin.mff.cuni.cz \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox