From mboxrd@z Thu Jan 1 00:00:00 1970 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 4D94EC77B7D for ; Sun, 7 May 2023 10:55:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231650AbjEGKzU (ORCPT ); Sun, 7 May 2023 06:55:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35790 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231609AbjEGKzM (ORCPT ); Sun, 7 May 2023 06:55:12 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 016206A6D for ; Sun, 7 May 2023 03:55:08 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 497A261B41 for ; Sun, 7 May 2023 10:55:08 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5AE0BC433EF; Sun, 7 May 2023 10:55:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1683456907; bh=rRCSFBoxStdttkLwKVVwuEaQmWITHOk2+0hbY7XTdHw=; h=Subject:To:Cc:From:Date:From; b=qDzqFixSXF7xfFsoNwjdjJB+BgGTrzVlbV5JpnvlJbyjqLliS2RBTLMQReXC80kct t0wzopUwPYZE4tTdNIuSC2d9vhFLtPqIMR8b/5oikccq9Qr5p/wm5AxIhvhq8MoMSn 2bRqKjmAFcfbHl1KdWY2mi6BTxU/amSJSyvaT6Sc= Subject: FAILED: patch "[PATCH] mailbox: zynqmp: Fix counts of child nodes" failed to apply to 6.1-stable tree To: tanmay.shah@amd.com, mathieu.poirier@linaro.org, michal.simek@amd.com Cc: From: Date: Sun, 07 May 2023 12:55:02 +0200 Message-ID: <2023050702-outcast-serrated-643b@gregkh> MIME-Version: 1.0 Content-Type: text/plain; charset=ANSI_X3.4-1968 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org The patch below does not apply to the 6.1-stable tree. If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to . To reproduce the conflict and resubmit, you may use the following commands: git fetch https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/ linux-6.1.y git checkout FETCH_HEAD git cherry-pick -x f72f805e72882c361e2a612c64a6e549f3da7152 # git commit -s git send-email --to '' --in-reply-to '2023050702-outcast-serrated-643b@gregkh' --subject-prefix 'PATCH 6.1.y' HEAD^.. Possible dependencies: f72f805e7288 ("mailbox: zynqmp: Fix counts of child nodes") 043f85ce81cb ("mailbox: zynq: Switch to flexible array to simplify code") thanks, greg k-h ------------------ original commit in Linus's tree ------------------ >From f72f805e72882c361e2a612c64a6e549f3da7152 Mon Sep 17 00:00:00 2001 From: Tanmay Shah Date: Fri, 10 Mar 2023 17:24:04 -0800 Subject: [PATCH] mailbox: zynqmp: Fix counts of child nodes 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 Cc: stable@vger.kernel.org Link: https://lore.kernel.org/r/20230311012407.1292118-2-tanmay.shah@amd.com Signed-off-by: Mathieu Poirier 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)