From patchwork Mon Aug 21 11:22:49 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Antipov X-Patchwork-Id: 716890 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 60F88EE4993 for ; Mon, 21 Aug 2023 11:24:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232022AbjHULYF (ORCPT ); Mon, 21 Aug 2023 07:24:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56162 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231625AbjHULYF (ORCPT ); Mon, 21 Aug 2023 07:24:05 -0400 Received: from forward102b.mail.yandex.net (forward102b.mail.yandex.net [178.154.239.149]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 53DCDE2 for ; Mon, 21 Aug 2023 04:24:00 -0700 (PDT) Received: from mail-nwsmtp-smtp-production-main-23.myt.yp-c.yandex.net (mail-nwsmtp-smtp-production-main-23.myt.yp-c.yandex.net [IPv6:2a02:6b8:c12:279e:0:640:5630:0]) by forward102b.mail.yandex.net (Yandex) with ESMTP id B543D60055; Mon, 21 Aug 2023 14:23:56 +0300 (MSK) Received: by mail-nwsmtp-smtp-production-main-23.myt.yp-c.yandex.net (smtp/Yandex) with ESMTPSA id tNGi4AeDdqM0-wnwM81ge; Mon, 21 Aug 2023 14:23:56 +0300 X-Yandex-Fwd: 1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yandex.ru; s=mail; t=1692617036; bh=1WDAslT8rRRAK/dQtkvBWwgXY2DNl9gcbKZlKp0iYDM=; h=Message-ID:Date:Cc:Subject:To:From; b=haLDETK17K/20a3pZOvb4W57jizJlHQzfVuZXJb3xZF7sKA5+oP5uPD9kYfO1Kn7T yrXm1WRiZROvWIJAOQ3RECecGbxTBpL9oUoPryupfRzPzPHua211wlnvaIVy3gvpXv A8P51UWZ9SRGXqzjwEGNZoY0oyVbRb9HG6FRbswU= Authentication-Results: mail-nwsmtp-smtp-production-main-23.myt.yp-c.yandex.net; dkim=pass header.i=@yandex.ru From: Dmitry Antipov To: Franky Lin Cc: Arend van Spriel , Kalle Valo , linux-wireless@vger.kernel.org, brcm80211-dev-list.pdl@broadcom.com, Dmitry Antipov Subject: [PATCH] wifi: brcmfmac: always check the value returned by brcmf_chip_add_core() Date: Mon, 21 Aug 2023 14:22:49 +0300 Message-ID: <20230821112337.160974-1-dmantipov@yandex.ru> X-Mailer: git-send-email 2.41.0 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org In 'brcmf_chip_recognition()', always check the value returned by 'brcmf_chip_add_core()' with 'IS_ERR()' and return convenient 'PTR_ERR()' in case of error. Fixes: cb7cf7be9eba ("brcmfmac: make chip related functions host interface independent") Signed-off-by: Dmitry Antipov --- .../net/wireless/broadcom/brcm80211/brcmfmac/chip.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/chip.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/chip.c index 2ef92ef25517..6a1b593eeff6 100644 --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/chip.c +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/chip.c @@ -1006,18 +1006,28 @@ static int brcmf_chip_recognition(struct brcmf_chip_priv *ci) core = brcmf_chip_add_core(ci, BCMA_CORE_CHIPCOMMON, SI_ENUM_BASE_DEFAULT, 0); + if (IS_ERR(core)) + return PTR_ERR(core); brcmf_chip_sb_corerev(ci, core); core = brcmf_chip_add_core(ci, BCMA_CORE_SDIO_DEV, BCM4329_CORE_BUS_BASE, 0); + if (IS_ERR(core)) + return PTR_ERR(core); brcmf_chip_sb_corerev(ci, core); core = brcmf_chip_add_core(ci, BCMA_CORE_INTERNAL_MEM, BCM4329_CORE_SOCRAM_BASE, 0); + if (IS_ERR(core)) + return PTR_ERR(core); brcmf_chip_sb_corerev(ci, core); core = brcmf_chip_add_core(ci, BCMA_CORE_ARM_CM3, BCM4329_CORE_ARM_BASE, 0); + if (IS_ERR(core)) + return PTR_ERR(core); brcmf_chip_sb_corerev(ci, core); core = brcmf_chip_add_core(ci, BCMA_CORE_80211, 0x18001000, 0); + if (IS_ERR(core)) + return PTR_ERR(core); brcmf_chip_sb_corerev(ci, core); } else if (socitype == SOCI_AI) { ci->iscoreup = brcmf_chip_ai_iscoreup;