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 X-Spam-Level: X-Spam-Status: No, score=-3.8 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1BBE6C433ED for ; Tue, 27 Apr 2021 04:26:46 +0000 (UTC) Received: from shelob.surriel.com (shelob.surriel.com [96.67.55.147]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id C0FA961076 for ; Tue, 27 Apr 2021 04:26:45 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org C0FA961076 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=kernelnewbies-bounces@kernelnewbies.org Received: from localhost ([::1] helo=shelob.surriel.com) by shelob.surriel.com with esmtp (Exim 4.94) (envelope-from ) id 1lbFIw-0002Fh-98; Tue, 27 Apr 2021 00:26:34 -0400 Received: from mail.kernel.org ([198.145.29.99]) by shelob.surriel.com with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94) (envelope-from ) id 1lbFIu-0002Eo-9p for kernelnewbies@kernelnewbies.org; Tue, 27 Apr 2021 00:26:32 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 6D102610FC; Tue, 27 Apr 2021 04:26:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1619497591; bh=wHCRw8CK2beE0XTdU4DqF5r/0eO3m0TBvLp8G/39lrI=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=QsgLQA802lRgQG41+JTT7YNXDkeeVTjyUWUoiBHddmrFQK7OU1MM9TL1s+ah1Ssvq tdQUAKqojAuagZZTD/nKIByfgaDnfHgR1TS63rfZCkjYK7wDWB+6+L1M69iLsDLLpC 3Ppw4036l+a6FFp4SQCnmqPoAso2SocCXh9t9EGM2+Ir/NN2wdR/0QMc9QLMKaBWqW Pbu6zhmwq//QnbF8xiONVZq8CoQgLjWAyF5ygz4ANAerARxXvDTc/6q9pZVfbprbAl 8moIqQGd08X+Ib1ynjh2XPnIG3NRHm1I4ejmjCCbsbGMHEwi3Jdw8RDcRzcMjo54vb UB+BIiQe5FHPQ== Date: Tue, 27 Apr 2021 07:26:27 +0300 From: Leon Romanovsky To: bkkarthik Subject: Re: [PATCH] drivers: pnp: proc.c: Handle errors while attaching devices Message-ID: References: <20210424194301.jmsqpycvsm7izbk3@ubuntu> <20210426175031.w26ovnffjiow346h@burgerking> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20210426175031.w26ovnffjiow346h@burgerking> Cc: gregkh@linuxfoundation.org, Anupama K Patil , "Rafael J. Wysocki" , linux-kernel@vger.kernel.org, Jaroslav Kysela , linux-acpi@vger.kernel.org, kernelnewbies@kernelnewbies.org, skhan@linuxfoundation.org X-BeenThere: kernelnewbies@kernelnewbies.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: Learn about the Linux kernel List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: kernelnewbies-bounces@kernelnewbies.org On Mon, Apr 26, 2021 at 11:20:32PM +0530, bkkarthik wrote: > On 21/04/26 08:04AM, Leon Romanovsky wrote: > > On Sun, Apr 25, 2021 at 01:13:01AM +0530, Anupama K Patil wrote: > > > isapnp_proc_init() does not look at the return value from > > > isapnp_proc_attach_device(). Check for this return value in > > > isapnp_proc_detach_device(). > > > > > > Cleanup in isapnp_proc_detach_device and > > > isapnp_proc_detach_bus() for cleanup. > > > > > > Changed sprintf() to the kernel-space function scnprintf() as it returns > > > the actual number of bytes written. > > > > > > Removed unnecessary variables de, e of type 'struct proc_dir_entry' to > > > save memory. <...> > > > +static int isapnp_proc_detach_device(struct pnp_dev *dev) > > > +{ > > > + proc_remove(dev->procent); > > > + dev->procent = NULL; > > > + return 0; > > > +} > > > + > > > +static int isapnp_proc_detach_bus(struct pnp_card *bus) > > > +{ > > > + proc_remove(bus->procdir); > > > + return 0; > > > +} > > > > Please don't add one line functions that are called only once and have > > return value that no one care about it. > > These were only intended for a clean-up job, the idea of this function came from how PCI handles procfs. > Maybe those should be changed? Probably, the CONFIG_PROC_FS around pci_proc_*() is not needed too. Thanks _______________________________________________ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies