Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757587AbXJ2R3E (ORCPT ); Mon, 29 Oct 2007 13:29:04 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1759618AbXJ2R2x (ORCPT ); Mon, 29 Oct 2007 13:28:53 -0400 Received: from twin.jikos.cz ([213.151.79.26]:60971 "EHLO twin.jikos.cz" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1758419AbXJ2R2w (ORCPT ); Mon, 29 Oct 2007 13:28:52 -0400 Date: Mon, 29 Oct 2007 18:28:36 +0100 (CET) From: Jiri Kosina To: Dirk Hohndel cc: Jeff Garzik , Dmitry Torokhov , 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 In-Reply-To: <20071029152050.GA23411@bigserver.hohndel.org> Message-ID: References: <20071029152050.GA23411@bigserver.hohndel.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 827 Lines: 27 On Mon, 29 Oct 2007, Dirk Hohndel wrote: > 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. Actually both of the cases are fine -- it is valid to pass NULL pointer to kfree() and to input_free_device() too. > Would something like this work? Yes, I think that this patch is in principle fine, modulo the redundant NULL-ptr checks. Thanks, -- Jiri Kosina - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/