Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp829131pxb; Tue, 3 Nov 2020 13:44:45 -0800 (PST) X-Google-Smtp-Source: ABdhPJyYPC9rePPNXfzZNwZNGe3JzdP7TJ3T3DPbCSXXn5m2+qC8nHnLqXdfX6qKoCLgXtjmS/po X-Received: by 2002:a50:cc86:: with SMTP id q6mr24837296edi.78.1604439885348; Tue, 03 Nov 2020 13:44:45 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1604439885; cv=none; d=google.com; s=arc-20160816; b=EdY6aDMDTX9VoZhCbVPt4azdrLWTHDZbAK4OE2hZ3sGYqoVOXYF+8a4jmPqESZT9fq FYFFa6U62FakTiQ+/030OycpRoD/lyaiWL/3wAZCWAqGtz1DAg/v5cI4kIDQLfffN4+Q eYP9Vf9MEQ1nn+ShUfKTbDZNFz+rh3AEWH3EhrjzPoNJy+iI2icSQfS0BhNxLc8BUkvX Oz6mcqW4KFCm3FsGlbwdYUZhw5IXYarM6f4ryDKr19IzJvDQx6bH/UGaTrHJbzoJql+V ckXHhouEHal7dCQe32k6TNeX6c8FHYjGPwx3dcvBH14/XxNm+kibqgEzz1wtr46D1pqJ 40xA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=gmHlDTkkxXBvzOxthAWjr8qcP8N8MENBIIiy1OgJ8f0=; b=VejF+zR5mzVfCqp5KOoGs2jn7omPAIP0CGqwrjHg/14adOPgj2/l97xp9Qhzj4Sct6 b8Ch46lTYvFv0ia5dCOuqAz1VY6vueC39xc61mcXAgsDtj1D84K2ENMWZ1XN2br6fryE uzclAjulMuh7d+4koWgW215bUk11S12wVXspqQX15B55o7VjgF5f+gsXTSCp68rBTGm0 CZTIAwrmXaPTNEUjFzzeG+Yg1yT1op/tYeSn5rKdcUhDe4GAoGpkiTG0moZEyxnXxUio pY/bXK8OTZEEd+be6xiWnKlAe33zAQ+xZ/Pp8MYWu/iS+ZZVP7Y0GjXB6k+uz1pjk7hx dV9A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=ZHAJtmxD; 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=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id r17si16141490eds.37.2020.11.03.13.44.22; Tue, 03 Nov 2020 13:44:45 -0800 (PST) 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=default header.b=ZHAJtmxD; 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=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732335AbgKCUzc (ORCPT + 99 others); Tue, 3 Nov 2020 15:55:32 -0500 Received: from mail.kernel.org ([198.145.29.99]:55592 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732016AbgKCUzS (ORCPT ); Tue, 3 Nov 2020 15:55:18 -0500 Received: from localhost (83-86-74-64.cable.dynamic.v4.ziggo.nl [83.86.74.64]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 1C27B2053B; Tue, 3 Nov 2020 20:55:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1604436917; bh=WYiJwE9DBiw6w8jvK/vQddDO1Ft7twNhSM2ANKM0Zfo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ZHAJtmxDE3yMtsaXwNd/QO2BCfL+JpdUIWuDenO0GeaPEhpoZdrqLHow9hEHse6yN Ykfu3S9QgH9/szVcaHpV6sSIJigv8E3rHJgoji2QP96YbGtkO5Ys80PnkEHyRzqwzX oUMvUuS4xGZ0DbMRtFFAtDTx/n5DOn1VZVjOJits= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Wright Feng , Chi-hsien Lin , Kalle Valo , Sasha Levin Subject: [PATCH 5.4 066/214] brcmfmac: Fix warning message after dongle setup failed Date: Tue, 3 Nov 2020 21:35:14 +0100 Message-Id: <20201103203256.576438167@linuxfoundation.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201103203249.448706377@linuxfoundation.org> References: <20201103203249.448706377@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Wright Feng [ Upstream commit 6aa5a83a7ed8036c1388a811eb8bdfa77b21f19c ] Brcmfmac showed warning message in fweh.c when checking the size of event queue which is not initialized. Therefore, we only cancel the worker and reset event handler only when it is initialized. [ 145.505899] brcmfmac 0000:02:00.0: brcmf_pcie_setup: Dongle setup [ 145.929970] ------------[ cut here ]------------ [ 145.929994] WARNING: CPU: 0 PID: 288 at drivers/net/wireless/broadcom/brcm80211/brcmfmac/fweh.c:312 brcmf_fweh_detach+0xbc/0xd0 [brcmfmac] ... [ 145.930029] Call Trace: [ 145.930036] brcmf_detach+0x77/0x100 [brcmfmac] [ 145.930043] brcmf_pcie_remove+0x79/0x130 [brcmfmac] [ 145.930046] pci_device_remove+0x39/0xc0 [ 145.930048] device_release_driver_internal+0x141/0x200 [ 145.930049] device_release_driver+0x12/0x20 [ 145.930054] brcmf_pcie_setup+0x101/0x3c0 [brcmfmac] [ 145.930060] brcmf_fw_request_done+0x11d/0x1f0 [brcmfmac] [ 145.930062] ? lock_timer_base+0x7d/0xa0 [ 145.930063] ? internal_add_timer+0x1f/0xa0 [ 145.930064] ? add_timer+0x11a/0x1d0 [ 145.930066] ? __kmalloc_track_caller+0x18c/0x230 [ 145.930068] ? kstrdup_const+0x23/0x30 [ 145.930069] ? add_dr+0x46/0x80 [ 145.930070] ? devres_add+0x3f/0x50 [ 145.930072] ? usermodehelper_read_unlock+0x15/0x20 [ 145.930073] ? _request_firmware+0x288/0xa20 [ 145.930075] request_firmware_work_func+0x36/0x60 [ 145.930077] process_one_work+0x144/0x360 [ 145.930078] worker_thread+0x4d/0x3c0 [ 145.930079] kthread+0x112/0x150 [ 145.930080] ? rescuer_thread+0x340/0x340 [ 145.930081] ? kthread_park+0x60/0x60 [ 145.930083] ret_from_fork+0x25/0x30 Signed-off-by: Wright Feng Signed-off-by: Chi-hsien Lin Signed-off-by: Kalle Valo Link: https://lore.kernel.org/r/20200928054922.44580-3-wright.feng@cypress.com Signed-off-by: Sasha Levin --- .../net/wireless/broadcom/brcm80211/brcmfmac/fweh.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fweh.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fweh.c index 79c8a858b6d6f..a30fcfbf2ee7c 100644 --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fweh.c +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fweh.c @@ -304,10 +304,12 @@ void brcmf_fweh_detach(struct brcmf_pub *drvr) { struct brcmf_fweh_info *fweh = &drvr->fweh; - /* cancel the worker */ - cancel_work_sync(&fweh->event_work); - WARN_ON(!list_empty(&fweh->event_q)); - memset(fweh->evt_handler, 0, sizeof(fweh->evt_handler)); + /* cancel the worker if initialized */ + if (fweh->event_work.func) { + cancel_work_sync(&fweh->event_work); + WARN_ON(!list_empty(&fweh->event_q)); + memset(fweh->evt_handler, 0, sizeof(fweh->evt_handler)); + } } /** -- 2.27.0