Received: by 2002:a05:6a10:a841:0:0:0:0 with SMTP id d1csp4183063pxy; Mon, 26 Apr 2021 21:29:03 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy0kyawoKOyYXSefaciWTW6oa30D4WSBgWV5g74wsvUZ/mAbRNpLN+u888PtCiTUYIiqqo8 X-Received: by 2002:aa7:db9a:: with SMTP id u26mr2055305edt.292.1619497743062; Mon, 26 Apr 2021 21:29:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1619497743; cv=none; d=google.com; s=arc-20160816; b=scKLUCaxZfzIqAlmxmE308Chcdgkkur603mE2MD23uJon3/Dpy2wxugtBtt7TN5/ZO +q8pwGdtGU3/cz2Q5+iVIPICpk0li7gX1IT99Qrb55zYvsiEWDdCNFzGKOIann6ECiji mNohoB8AlyoXMbvj5PjdBPQEDARksglhG2J6zYtgZrpWur1i3STHMLwf2eU93DlKxEMP O7WItb7XjohBLBOp/+OmcN+6ocKDTRXux+UGvpn7uGCwuDjqwCmEWwmuaBdrD/DHoqxC S8ut5ldhYZl2YRuWQcKEwX/jFPEMn27UZcVzYrjXHnlIJZLXvl87/ljYGlJcHFreOCVX 4X9A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=MsXs7DB/NMl+DVeOmgOq6w7dxkUz6Ha1OkcoZ/Af8Co=; b=o1UEnFKbRGOICKH3xuVkVronVmVzpehmuCHL3tgyrJqBibe12sV01Tj+wT5bKQ/sx4 bPq5VG1pAlp6b4Mnmkf/0+piQGatg/Z3bjw9rzg3ocg/MS1tkpazMrMgIc2xIC8Ap8fh PFBZtmys4MuJ1B06dogA5fPHBZZ/414ZEHhgsslcaSzT+/5YYH/fiL4TsGgKr7gcxgYA mMZDiSzg+m6imDlTqPklN/3E7ZnWgXlQGRPy351+TWhUi4Ed1ubOzcJ62eugN/rmbJZ+ pF+T2BweJAjdUlzxBJodU3icMxMORHDfeGnU6WTmcBRSuMa7o0MmUgJgbUgvCsOuVrpy e0Rw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=QsgLQA80; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id a4si773022edv.51.2021.04.26.21.28.39; Mon, 26 Apr 2021 21:29:03 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=QsgLQA80; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234666AbhD0E1O (ORCPT + 99 others); Tue, 27 Apr 2021 00:27:14 -0400 Received: from mail.kernel.org ([198.145.29.99]:48878 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229490AbhD0E1N (ORCPT ); Tue, 27 Apr 2021 00:27:13 -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 Cc: Anupama K Patil , Jaroslav Kysela , "Rafael J. Wysocki" , linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org, skhan@linuxfoundation.org, gregkh@linuxfoundation.org, kernelnewbies@kernelnewbies.org 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-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable In-Reply-To: <20210426175031.w26ovnffjiow346h@burgerking> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.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(). > > >=20 > > > Cleanup in isapnp_proc_detach_device and > > > isapnp_proc_detach_bus() for cleanup. > > >=20 > > > Changed sprintf() to the kernel-space function scnprintf() as it retu= rns > > > the actual number of bytes written. > > >=20 > > > 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 =3D NULL; > > > + return 0; > > > +} > > > + > > > +static int isapnp_proc_detach_bus(struct pnp_card *bus) > > > +{ > > > + proc_remove(bus->procdir); > > > + return 0; > > > +} > >=20 > > Please don't add one line functions that are called only once and have > > return value that no one care about it. >=20 > These were only intended for a clean-up job, the idea of this function ca= me from how PCI handles procfs. > Maybe those should be changed? Probably, the CONFIG_PROC_FS around pci_proc_*() is not needed too. Thanks