Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752837Ab1CXOzN (ORCPT ); Thu, 24 Mar 2011 10:55:13 -0400 Received: from iolanthe.rowland.org ([192.131.102.54]:45435 "HELO iolanthe.rowland.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with SMTP id S1751630Ab1CXOzL (ORCPT ); Thu, 24 Mar 2011 10:55:11 -0400 Date: Thu, 24 Mar 2011 10:55:08 -0400 (EDT) From: Alan Stern X-X-Sender: stern@iolanthe.rowland.org To: Sergey Senozhatsky cc: Greg Kroah-Hartman , Chris Wright , , Subject: Re: check device_create_file() return code in usb_create_sysfs_intf_files() In-Reply-To: <20110324143116.GA8200@swordfish.minsk.epam.com> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 923 Lines: 24 On Thu, 24 Mar 2011, Sergey Senozhatsky wrote: > Hello, > > I just noticed that usb_create_sysfs_intf_files() ignores device_create_file() > return code and sets intf->sysfs_files_created to 1, even if sysfs_add_file_mode() > returned -ENOMEM (or later sysfs_add_one() returned -EEXIST). > > Shouldn't we check retval for 0 before setting intf->sysfs_files_created? No. We want this routine to succeed even if the sysfs files can't be created. The interface string attribute is more or less optional. It would be okay to add a comment explaining this, so that other people don't make the same mistake (which has already happened -- you're not the first). Alan Stern -- 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/