From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D0344C433EF for ; Thu, 9 Jun 2022 13:19:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243840AbiFINT1 (ORCPT ); Thu, 9 Jun 2022 09:19:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47770 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1343813AbiFINS3 (ORCPT ); Thu, 9 Jun 2022 09:18:29 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1CF2D3CE241 for ; Thu, 9 Jun 2022 06:18:23 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id B24D0B82DD9 for ; Thu, 9 Jun 2022 13:18:21 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 14E1DC34114; Thu, 9 Jun 2022 13:18:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1654780700; bh=t5OTrTMFJxvNLCc0YnLnqwrnW6F9Kn/Juv50fvZvLmc=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=SMp+tiQt7wzGFD+PRoBFCJSTl+yh4qeE7cXZWFofJyq7HmztJtiekgIjOgQhsbk9x NS1qKa14xc6I7+j2Um+LMeAya3pU6+ZsEBPJLWtCNdbxpeutOAcFiP1duFp+od1CoK pSK6x1dPDeNi7LTKU7ssKAjbA0m7ybOEEh3C+aBs= Date: Thu, 9 Jun 2022 15:18:17 +0200 From: Greg KH To: Zheyu Ma Cc: Jiri Slaby , fseidel@suse.de, Linux Kernel Mailing List Subject: Re: [PATCH] tty: nozomi: Return an error when failing to create the sysfs Message-ID: References: <20220609083133.4120738-1-zheyuma97@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Jun 09, 2022 at 07:03:32PM +0800, Zheyu Ma wrote: > On Thu, Jun 9, 2022 at 4:38 PM Greg KH wrote: > > > > On Thu, Jun 09, 2022 at 04:31:33PM +0800, Zheyu Ma wrote: > > > The driver does not handle the error of the creation of sysfs, resulting > > > in duplicate file names being created. > > > > > > The following log can reveal it: > > > > > > [ 52.907211] sysfs: cannot create duplicate filename '/devices/pci0000:00/0000:00:05.0/card_type' > > > > How is the same file being created in a normal codepath? > > > > Is the same device being registered twice somehow? > > In fact, I tried to load the nozomi driver twice. How? Modules should not be able to be in memory twice. > In the first load, the driver failed at tty_port_register_device(), > performed error handling and returned an error, but by this time the > make_sysfs_files() had been executed and the sysfs had been created. > In the second load, the make_sysfs_files() is executed again and this > warning is returned. Ah, ok, if you make the other changes I suggested, this will not be a problem. thanks, greg k-h