From patchwork Sat Mar 11 01:24:04 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tanmay Shah X-Patchwork-Id: 13170596 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id E713EC6FA99 for ; Sat, 11 Mar 2023 01:25:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:CC:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=5knPKWAbx5fzlm/4QmXLtHRqR1upxEORrrW/knwWNdE=; b=S12oWj2FCifoRm lEdCbqpHm0DNGAC5O/OjJtMl6YWm3GaCIImbk8EwWKSlUe0VWerauogcinwJqmjik+htkWt0JiJ3e tedphfPAvepp9kd33nAiCSqq16PRLkQDznGvOHjDenrHFHyauC/z0JHn3bhozcc70Mq7FeoIlkQgF a2iiaVPkFQpdbOprsTGL4bmsNuH12AkCBJREymDcHnnK/ftwO0Euoh4nke9cDKYwZuzv5IfWIJkRu tKZngsKcQYe+Q57Bv2yJQdTobuMpNcwrJXh0NzxdZoaruVyfmkeHI/pw4A668rLXMKnm2cKuZNHDs oI2wfWEhXqr10DsDk8cg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1panyX-00Gski-MD; Sat, 11 Mar 2023 01:24:45 +0000 Received: from mail-dm6nam10on2062b.outbound.protection.outlook.com ([2a01:111:f400:7e88::62b] helo=NAM10-DM6-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1panyL-00Gsi9-U1 for linux-arm-kernel@lists.infradead.org; Sat, 11 Mar 2023 01:24:36 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=UKRX6fY3A8MaKAIJebBCdPywgqlAMMOpVjCKIjBNlf6UtMdkoLfTqVUHe0QLw0zgjQNWMLYVz8Dj3P6Gh9rtrMT9X4x3NkYMtbosbEvbnk7NOiSEE1H2ovc62fnymkQr0MVSK4iZH0D2bQnEamR59+loKZm8hgh/w7N31fhUB+LKpvMYaJl8J+MxbCoPMdH7z+OZKvloEA56IQicI7RZmfVjgMwpwqPSF3qV/7lw2H62+KVUH7AyCegh+9rbgMKw0O0srkp/k1nVLOxg2HwbVkDvRap1x8L3YdUgVYtmNddMKsKzNPXvsAz2qoEZDyR/R0e9dbQMZZuMJpZZ0nOPbg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=0ntPHILyKl2B6cfodi6MlDi1IviUtfZyL+6c62G5yqY=; b=AMrclQ/OwtJaKXQ2Wm0/3KvIm9sX0MqFFOlYf1E6XdAsmHSfnQlGHzRBInseYt6lMvF4l71bx6MNkJkhaHp4S29dFh5F0JpNN6D6SxMv91ArW63BVoOklFG22bfa6mx10ZT9H2fcQiqZcVk7yhEO+hR6NyvpZGuja0le4zdran8DGIylwu7z6sM5MCSmJXNNkKLNxxqIGaF5uM0i0VlIFmk8R4tlmB6giJijVwJZ2PuU+KvflEGWr0baRynIUvyjPxOTV11yi45ZKar9f+l2zczpD7fOZLYktX17LfGo3QvzdjRX4f9I11QCM16vxZZzkKgxTgj8p+RtNz13qtDthw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=kernel.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=0ntPHILyKl2B6cfodi6MlDi1IviUtfZyL+6c62G5yqY=; b=be3F53iwmslp2uqnd8tuLFoP+cR/HQex44+oDLdrU96PtO+LFkpGOeM//oE4B54+/cb3ldPVWIHkLhPnDdnlohnWrYfi+dzTyXiO5BJf57VaBYSfjgreboKMeuEPCjMBOKxHHOWRGXMjmr3o1Sq1fNIeIugnssQ7/1qUR4wDSpg= Received: from DM6PR14CA0048.namprd14.prod.outlook.com (2603:10b6:5:18f::25) by CH3PR12MB8353.namprd12.prod.outlook.com (2603:10b6:610:12c::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6178.19; Sat, 11 Mar 2023 01:24:28 +0000 Received: from DM6NAM11FT114.eop-nam11.prod.protection.outlook.com (2603:10b6:5:18f:cafe::87) by DM6PR14CA0048.outlook.office365.com (2603:10b6:5:18f::25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6178.20 via Frontend Transport; Sat, 11 Mar 2023 01:24:28 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB03.amd.com; pr=C Received: from SATLEXMB03.amd.com (165.204.84.17) by DM6NAM11FT114.mail.protection.outlook.com (10.13.172.206) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6178.22 via Frontend Transport; Sat, 11 Mar 2023 01:24:28 +0000 Received: from SATLEXMB04.amd.com (10.181.40.145) by SATLEXMB03.amd.com (10.181.40.144) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.34; Fri, 10 Mar 2023 19:24:27 -0600 Received: from xsjtanmays50.xilinx.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server id 15.1.2375.34 via Frontend Transport; Fri, 10 Mar 2023 19:24:26 -0600 From: Tanmay Shah To: , , , , , CC: , , , Tanmay Shah Subject: [PATCH v5 1/5] mailbox: zynqmp: fix counts of child nodes Date: Fri, 10 Mar 2023 17:24:04 -0800 Message-ID: <20230311012407.1292118-2-tanmay.shah@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230311012407.1292118-1-tanmay.shah@amd.com> References: <20230311012407.1292118-1-tanmay.shah@amd.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM6NAM11FT114:EE_|CH3PR12MB8353:EE_ X-MS-Office365-Filtering-Correlation-Id: 81debf0d-7d45-43e9-532b-08db21cf5ba6 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: zlsMHE4zgO7LvboKST9Uc5uMZZzqodIwK7WKlqD04EkI6lSgFxEWIMoxFMXSD0QXEe1O2Y6rqX6LsPBb8bTlke/VPqdKF1uiHlIIctlDgTQbrPxCjbDOHszV4OvSZpvYz57avSgx6jsbU0mvcbTxP/KWmTwep9dR2o3T7XKCxc2mnRTFxS585OSbYvXa0rQB9glvsQIjoI3GqPiJJbPqf20AD1Oqp461rz0oTkyPFyBwZEztt2A0xxx9o01fjO3wKyE84MWBMtHDHWshxXE0RqP2R2IUNVlohnCtljNlfhZIy3liAb6TrSTneQA0qiyOkBl85Idp0IUNVsB+LhtTcOsciAox++Mr/oqVS6m3fnPeqPBTOpHTpYYsr3Tf2RfgHOXpw3GZ6fwWkAGjG+qz1QGKZSBLvWxhz1SaD89Z4S30ylHiApnU0riQmyhP9Ripjjv/nRgFo1hzCIb0H/74OPKgnBn88qvJQYWoW6dujTnYpV1BEyrJBsKsftFbhI9OhVFgJ7UGW0PZVvMEN5JhPBpv3CvW+LuoyDwmNirL/GReW5SM+4QcHtRhWaCBICYsY1crOdEfsSfhsdoNRfj93YKDNdMCJtGAjAGDkNGDTgWLoBsSAQOcvdr0scsnpdZ1BfeqQY3+n+onOB48S4uP09ZBn0jQzSxLXaR3ErOiHvJ7snNqfka+qVIHOdgPA4CKuytQddNtSpg9y0jBz0bgfiVKy9NMyqICY7MBT4jkY3M= X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB03.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230025)(4636009)(346002)(396003)(136003)(376002)(39860400002)(451199018)(36840700001)(46966006)(40470700004)(44832011)(15650500001)(5660300002)(26005)(2906002)(8936002)(36756003)(4326008)(70206006)(70586007)(8676002)(316002)(110136005)(1076003)(356005)(41300700001)(40480700001)(6636002)(86362001)(478600001)(54906003)(40460700003)(6666004)(36860700001)(81166007)(82740400003)(336012)(186003)(2616005)(426003)(82310400005)(83380400001)(47076005)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Mar 2023 01:24:28.1849 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 81debf0d-7d45-43e9-532b-08db21cf5ba6 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d;Ip=[165.204.84.17];Helo=[SATLEXMB03.amd.com] X-MS-Exchange-CrossTenant-AuthSource: DM6NAM11FT114.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH3PR12MB8353 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230310_172434_360581_3E073E5B X-CRM114-Status: GOOD ( 12.73 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org If child mailbox node status is disabled it causes crash in interrupt handler. Fix this by assigning only available child node during driver probe. Fixes: 4981b82ba2ff ("mailbox: ZynqMP IPI mailbox controller") Signed-off-by: Tanmay Shah Acked-by: Michal Simek --- Changes in v5: - mailbox node count should not be 0 for driver to probe drivers/mailbox/zynqmp-ipi-mailbox.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/drivers/mailbox/zynqmp-ipi-mailbox.c b/drivers/mailbox/zynqmp-ipi-mailbox.c index a4c8d23c76e2..ae47fbac38d2 100644 --- a/drivers/mailbox/zynqmp-ipi-mailbox.c +++ b/drivers/mailbox/zynqmp-ipi-mailbox.c @@ -634,7 +634,12 @@ static int zynqmp_ipi_probe(struct platform_device *pdev) struct zynqmp_ipi_mbox *mbox; int num_mboxes, ret = -EINVAL; - num_mboxes = of_get_child_count(np); + num_mboxes = of_get_available_child_count(np); + if (num_mboxes == 0) { + dev_err(dev, "mailbox nodes not available\n"); + return -EINVAL; + } + pdata = devm_kzalloc(dev, struct_size(pdata, ipi_mboxes, num_mboxes), GFP_KERNEL); if (!pdata)