Received: by 2002:a05:6a10:6d10:0:0:0:0 with SMTP id gq16csp982729pxb; Fri, 22 Apr 2022 15:56:10 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxAe/bV8GQu4b8hrWnVAxA6PM3FDlZGvyX6SCiU+Imi7ekDABSBUW8+lEEMANFJyCRudMwX X-Received: by 2002:a05:6a00:1701:b0:50a:8483:a163 with SMTP id h1-20020a056a00170100b0050a8483a163mr7400223pfc.79.1650668170385; Fri, 22 Apr 2022 15:56:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650668170; cv=none; d=google.com; s=arc-20160816; b=mrQ8NQdoS2uLuU5daDCntM2yfrOFIr4QVaFA3L7BjXKa3plIbFh9p8mNyMP7XlGQSy eFvqT38z2b1ADutnFn3s5yqUjkUrL3WDsUqa982VEmq0khoF45Y6x2OT5sFjgLd2osem WnPK2ETo/obRYlJtLmlYysIcOYFNMrN89aSTnuBbkJNI+9KHqsZCxSHQyqzziB9UI+7/ zrqo1HvHRXOWkFJN6cMn9WUkUT84/u7k2YTQfvvNmDujVEzQqKeJ0Ltcbsx4D1qe7d7b vWzDytQy7p48ka6t4iDBVwTVy9VJJE0cBcEz1fBfSufmU33I3s00FMwhUDIYRgVvlxmI aUZA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:references :in-reply-to:mime-version:dkim-signature; bh=lJJBFt56R7/LV6qOU2z7Q3rUmY3lVFuPnYXDX2dxxhQ=; b=KrOhi5Arp9gaTmhTMK4po8tJTtJ8XPbqg4hPFO+lkiXy93n7H7PX0Uqe8ARW9qAALf W3CtaArvlFB133BWL2an14F1IoiHAlRM41ZZ44pGUlnybKnG03/eDXrZ6NjD6kiv/wa6 rngpQvt2RtKAQMvTrxffVm8vv5DGU6x+Xd9CKUy5EMJr8Y1Aa3fBUPbp48VAlHWuyUFl 8HzNURdEiH0b+loIldBVDAluXz9LXGmIaq37vYclGkbV3tGKaVIpoSYNKc6QOBmhxvC6 fMDGYA0nKiN9izSm0F5ReqN8Hcj2VBN3Fq0dh0JplaH1cQi6qz0GKrtJALNLN2/k6qKp /K+w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=QD7uEPIw; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id q2-20020a632a02000000b003842921930bsi9048992pgq.808.2022.04.22.15.56.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Apr 2022 15:56:10 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=QD7uEPIw; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 10B7127F5C3; Fri, 22 Apr 2022 13:47:15 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229556AbiDVUoB (ORCPT + 99 others); Fri, 22 Apr 2022 16:44:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59808 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229504AbiDVUn7 (ORCPT ); Fri, 22 Apr 2022 16:43:59 -0400 Received: from mail-lf1-x132.google.com (mail-lf1-x132.google.com [IPv6:2a00:1450:4864:20::132]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DF77B16C22E; Fri, 22 Apr 2022 12:41:24 -0700 (PDT) Received: by mail-lf1-x132.google.com with SMTP id p12so10460805lfs.5; Fri, 22 Apr 2022 12:41:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=lJJBFt56R7/LV6qOU2z7Q3rUmY3lVFuPnYXDX2dxxhQ=; b=QD7uEPIwb+9FYvU/VPSEAmhebgEE43naJCLEPrC5G9+77tcWuN+k0klIL6fPlgTCRr BnabyalhFNdtvUbr00s3UyHI44vteLSunmOZkZx146Z1ZD+XT/Cm/L6wYNVkacTB013W pt6HuM+gnUyaNx3BJGqeFiGh5jQv7bhyBhtrHwGWf1TLOJdmZyY5cSZrYKnYhRon6AH3 MAebJ/mXFjLTm9lMs2oJkzNrregUaTpCqL+IISV8vHuehHeyF0zekxXeIYaDtV6pAbbx g3IGVnzSNTzuxqzj9DWAY5TjrX+gG9XN+f6eL6qNS+Ucly1AupD/MnHhEPbxgeNtmbt1 Dj8A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=lJJBFt56R7/LV6qOU2z7Q3rUmY3lVFuPnYXDX2dxxhQ=; b=jrcDH70VlkK8Y01A0DRLbZXs1b38jO75zqzKqCTDPW6QKPmG+plmAITe8g+Gb4nexj QqxSgG2SKpeETppGjHC3mAzpPCTnfRHnEDiWyXpa78FvfMkjpXA36uXX8bhbT4KXtK1l q9K1RozJFdH/eTX+3j7aVXZfmqTyxkzrQl4CDXs4FpWWa7UvJw5H9JvzUANwiZMXni9O YzBFBnfaPZMg4/NzWNYBcECIritvJTUEDmXqGf/KwifuvL0Wjerirt8Ck/pCbzOGMtPu rYI40TbGPbimgoeo8VAp5dYpfyTG5o3i5RhWjfmDsbmMHj/bVtjMwBTv7WT5fK4VRKKr 83pg== X-Gm-Message-State: AOAM533B0AkZSpj/2St/db3lhtZo0W8Xd/SyCfK7p4jaeMBUxBQkXrHp YwrBqH/iG92C0YYidPvyffaeDRSi/VF9qAzZPnyJVAez6D8= X-Received: by 2002:a2e:878d:0:b0:24e:f3cb:ad74 with SMTP id n13-20020a2e878d000000b0024ef3cbad74mr2751548lji.357.1650655541301; Fri, 22 Apr 2022 12:25:41 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:ab2:6308:0:b0:138:fd0a:136c with HTTP; Fri, 22 Apr 2022 12:25:40 -0700 (PDT) In-Reply-To: References: <20220409062449.3752252-1-zheyuma97@gmail.com> From: Stanislav Yakovlev Date: Fri, 22 Apr 2022 22:25:40 +0300 Message-ID: Subject: Re: [PATCH] wireless: ipw2x00: Refine the error handling of ipw2100_pci_init_one() To: Zheyu Ma Cc: kvalo@kernel.org, "David S. Miller" , Jakub Kicinski , pabeni@redhat.com, wireless , netdev@vger.kernel.org, Linux Kernel Mailing List Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-1.7 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RDNS_NONE, SPF_HELO_NONE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Zheyu, On 18/04/2022, Zheyu Ma wrote: > On Thu, Apr 14, 2022 at 2:40 AM Stanislav Yakovlev > wrote: >> >> On Sat, 9 Apr 2022 at 02:25, Zheyu Ma wrote: >> > >> > The driver should release resources in reverse order, i.e., the >> > resources requested first should be released last, and the driver >> > should adjust the order of error handling code by this rule. >> > >> > Signed-off-by: Zheyu Ma >> > --- >> > drivers/net/wireless/intel/ipw2x00/ipw2100.c | 34 +++++++++----------- >> > 1 file changed, 16 insertions(+), 18 deletions(-) >> > >> [Skipped] >> >> > @@ -6306,9 +6303,13 @@ static int ipw2100_pci_init_one(struct pci_dev >> > *pci_dev, >> > out: >> > return err; >> > >> > - fail_unlock: >> > +fail_unlock: >> > mutex_unlock(&priv->action_mutex); >> > - fail: >> > +fail: >> > + pci_release_regions(pci_dev); >> > +fail_disable: >> > + pci_disable_device(pci_dev); >> We can't move these functions before the following block. >> >> > +fail_dev: >> > if (dev) { >> > if (registered >= 2) >> > unregister_netdev(dev); >> This block continues with a function call to ipw2100_hw_stop_adapter >> which assumes that device is still accessible via pci bus. > > Thanks for your reminder, but the existing error handling does need to > be revised, I got the following warning when the probing fails at > pci_resource_flags(): > > [ 20.712160] WARNING: CPU: 1 PID: 462 at lib/iomap.c:44 > pci_iounmap+0x40/0x50 > [ 20.716583] RIP: 0010:pci_iounmap+0x40/0x50 > [ 20.726342] > [ 20.726550] ipw2100_pci_init_one+0x101/0x1ee0 [ipw2100] > > Since I am not familiar with the ipw2100, could someone give me some > advice to fix this. Could you please rebuild the kernel with IPW2100_DEBUG config option enabled, rerun the test and post your results here? Also, please post the output of "lspci -v" here. Stanislav.