Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp9128109pxu; Mon, 28 Dec 2020 07:18:23 -0800 (PST) X-Google-Smtp-Source: ABdhPJz5q8seLjftBsuY2NqzDRBlckSFCvUuNMT9HeimstqqcXl6NVXpGizxqRv4WLx+lqHzu29c X-Received: by 2002:a17:906:4050:: with SMTP id y16mr40710807ejj.537.1609168703472; Mon, 28 Dec 2020 07:18:23 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1609168703; cv=none; d=google.com; s=arc-20160816; b=duRN3Nc1MqyF0Fk/+avbE+jmyvbVLJROI19GPhOVx+fhWLSX2ooTjuarEzi3icDgmf ibfFeCPN4LWa543YX0bfbWoYmEwER9WbMs/qTdo7BGa4oyv/zsfuY8SDvP+i7dHe29rf kKUpM1y6ZL/CDOltjIrCa6P00wiOPeGq5wJGXJoxgbXnFK2kXWK4gr2b5TN6o35M1gUM B5qG4j1sBNm2079Pod2Y2W1JA25Tx6JF8gywlc1DKXjVRp5idIhq98wEiale8h4sVSQj 0YsuhfsaI3oc+meGjeX6HDC0SAi/Fn7bBB2tiN8pYEcBiAehimMwtEakpdnITl61EHUr jn6g== 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=tjGC/kDSVUInGX1I8YMM+keA3in5DxX+ViDdjciNyG8=; b=0AbsxKVbH0zx9S3F6ut96nNY4JCEGQZXBtk/uYVSXgdy2Q2xz0VV2azwA70FXjeZ5N 2aMmCySwZcaD4mACYOfKuBlmoS2QjkVQTSVfZsrKF97Qv09IxmxyJLKBJnI2+n8UXQ7W qAnpDkTD+i0IfXp7Hh2y73Ib2UwYxixRntfhHf5ARA4GZIXUK3YHuBD+6OrEJEGOwtTE riJZ3X1B5s47lV0MeRegRB29u5gI8OzzifG8iEDdwHfUdRJen3x+xZ0kR6CddEqX40n+ mvkWgODnIj1RkE5xdhtyDtaXye01NWUMK+u6ghxmXliC1JSUqPUbpSNVhPSAAIAUp6oE 2cqw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=bdfT1cMQ; 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=pass (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 j13si18666383ejc.454.2020.12.28.07.18.00; Mon, 28 Dec 2020 07:18:23 -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=@linuxfoundation.org header.s=korg header.b=bdfT1cMQ; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2437413AbgL1OEh (ORCPT + 99 others); Mon, 28 Dec 2020 09:04:37 -0500 Received: from mail.kernel.org ([198.145.29.99]:38432 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2437371AbgL1OEb (ORCPT ); Mon, 28 Dec 2020 09:04:31 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 07B5222583; Mon, 28 Dec 2020 14:04:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1609164256; bh=/CsNkTnhqTfltXlyCMYHPm/LxeE5LFUmI7fNs9s0wek=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=bdfT1cMQpuGSkjYOiNGR+GHN/7dMV9oPkN3PGQK753zMfzwDOofVysP1JH7bRUuS/ 3AaMz8XI7VgAhJjvjrghRYK16mxqk7fUGqK0goTWdiOeF0TMQgyRXxiET6O9NRO0yn BBFFlRBHaviOzhZEXx/0C/0ls6stUjbhEPVmo1HE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Cristian Marussi , Qinglang Miao , Sudeep Holla , Sasha Levin Subject: [PATCH 5.10 109/717] firmware: arm_scmi: Fix missing destroy_workqueue() Date: Mon, 28 Dec 2020 13:41:47 +0100 Message-Id: <20201228125026.178079162@linuxfoundation.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201228125020.963311703@linuxfoundation.org> References: <20201228125020.963311703@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: Qinglang Miao [ Upstream commit 6bbdb46c4b1bd57839c9c0a110bd81b0be0a4046 ] destroy_workqueue is required before the return from scmi_notification_init in case devm_kcalloc fails to allocate registered_protocols. Fix this by simply moving registered_protocols allocation before alloc_workqueue. Link: https://lore.kernel.org/r/20201110074221.41235-1-miaoqinglang@huawei.com Fixes: bd31b249692e ("firmware: arm_scmi: Add notification dispatch and delivery") Suggested-by: Cristian Marussi Reviewed-by: Cristian Marussi Signed-off-by: Qinglang Miao Signed-off-by: Sudeep Holla Signed-off-by: Sasha Levin --- drivers/firmware/arm_scmi/notify.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/firmware/arm_scmi/notify.c b/drivers/firmware/arm_scmi/notify.c index ce336899d6366..66196b293b6c2 100644 --- a/drivers/firmware/arm_scmi/notify.c +++ b/drivers/firmware/arm_scmi/notify.c @@ -1474,17 +1474,17 @@ int scmi_notification_init(struct scmi_handle *handle) ni->gid = gid; ni->handle = handle; + ni->registered_protocols = devm_kcalloc(handle->dev, SCMI_MAX_PROTO, + sizeof(char *), GFP_KERNEL); + if (!ni->registered_protocols) + goto err; + ni->notify_wq = alloc_workqueue(dev_name(handle->dev), WQ_UNBOUND | WQ_FREEZABLE | WQ_SYSFS, 0); if (!ni->notify_wq) goto err; - ni->registered_protocols = devm_kcalloc(handle->dev, SCMI_MAX_PROTO, - sizeof(char *), GFP_KERNEL); - if (!ni->registered_protocols) - goto err; - mutex_init(&ni->pending_mtx); hash_init(ni->pending_events_handlers); -- 2.27.0