Received: by 2002:a5b:505:0:0:0:0:0 with SMTP id o5csp1466771ybp; Fri, 4 Oct 2019 15:31:13 -0700 (PDT) X-Google-Smtp-Source: APXvYqxLdR+s9TFQPeO0FyWT6g6760ICMTXEuN77+q9iG9vL1uLvoBY3IfWsYfebZPETTTUytdkW X-Received: by 2002:a17:906:c310:: with SMTP id s16mr14792299ejz.178.1570228273458; Fri, 04 Oct 2019 15:31:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1570228273; cv=none; d=google.com; s=arc-20160816; b=YdsJz0F22zW8pvvlFaiRr8PLDqTMGYPGPHW7FSVl5LK+ATAY227fPOykccePB7EIof blyHEvgK3KJsUb7LaFMZ3Fwmrxf9nL2su0aZclHJqUNFkUiCGhuQAsoVply108Kl5zUE FN+DsMH6z/ZrM04UVbJCoCiay+sYO9pbKigL/1THEuh342xekyTb/Bq/OqUSDIDHUFlk 7zum+NxplzPpFMIJjJhEfPzD4zZawXTcX8FdDVJ2y/+CJS+KVfbwfzI1FVJA7TC4UWHR ChIPHFrL4B00w/deZxcjbExtqR9aEgQDxtvoavHZciLFW8MeSBZvoNezYbjSeKVeTAIL tk3A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature; bh=eTUNCaOOSGwA+ig+a2CKta3BFk73Lmp2ve0uszPOGFc=; b=V+dmM09xFR4oX85S/KGa2I2bdNhqdE945P30LXltEy+up3AflxrhTKTVbctyaI8viF Z8BnBNgU2msK8VaJ6Cdfn7rxG17SX/Hz01QDH5Nm+SpAVSEFlrcpy8rTIzYPZYMOmIe6 EUueW+fLEV7SiTMxAofKN4C8UVHdDBKElhoYRaWsOk6RYlyLx0aQ97x3+njp9gXpaIIR t9Ws48g/pfcuo1Xqlavrnv1Q0jdW1dJFFBtjps09zSXa7ztKF8JqbuWSw3xN50PBv9fX aR/E+XbGhnbwd0D74ro8FpbAY4MYNmDby6jgrB1ffGlbbxf2tYQRYwFZi2NX2M6I4KSU yrgg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=br7cGTb8; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id n2si4380898edt.408.2019.10.04.15.30.50; Fri, 04 Oct 2019 15:31:13 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=br7cGTb8; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388839AbfJDW1h (ORCPT + 99 others); Fri, 4 Oct 2019 18:27:37 -0400 Received: from mail-pg1-f195.google.com ([209.85.215.195]:35380 "EHLO mail-pg1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388197AbfJDW1O (ORCPT ); Fri, 4 Oct 2019 18:27:14 -0400 Received: by mail-pg1-f195.google.com with SMTP id p30so2457401pgl.2 for ; Fri, 04 Oct 2019 15:27:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=eTUNCaOOSGwA+ig+a2CKta3BFk73Lmp2ve0uszPOGFc=; b=br7cGTb8FH/qLzSnTzorqurt95SrUFywuFB5Jl8nSZ7AiRZhJKECx1dlOZkzMPQ2de TI1tjqQbCkW9EHXKfKG7xkzTJMC/7Qy6nJJL98/o+m//yicGc2lAl7axy70kmOlCuoAi 8y0cNXf8U+jYYxIync3074I2CzZAIS81DVyhRRzRBsFn4cqEQxUnAphdR9CKenTeBiKE Da76fC7/0+PavmPZSpvRvz7wGQHMcf15iQfAoREnVjNpN2syvrWojYJvp8kReVwph+HW wpiCnrI0daqKIORVVW6qp8rF8XZy1UwRNwB8jlmE2X4H7Yt3Ek4Z0i7WEHj6VSswUeki 7FSA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=eTUNCaOOSGwA+ig+a2CKta3BFk73Lmp2ve0uszPOGFc=; b=LvmqnIL93PSyfcENpS7ULFZVLwIpnGm/73JJvkrZ36FesOOeiLJ4IRy4F6JMT6XBjH RvSEvnA5z0uum9Z7h1be7ccjtvI4S+KsUrQyYYzedMXyDUzfL8cnk91QuwhTHJ14vkgs cueOwUBLFGrjv7ahToZ0NbtkTMRroZqKZ/QH+6BfcLQbUv6PxItIy0l7KUYAVz9SIEMr Zz0JRpxD4+Mhu0uTNPepM5i7+ShCSvXWTD6BDU4c/TbFWj5ra4livVai/8c/3ldadCct WtawD1giTuxVIM0Q9ZtpAO0iacmy8I3i6CP5qEzslgg1Z5Ek0Ha24bW08uIFM5QJP2AZ 699Q== X-Gm-Message-State: APjAAAXmKM0yWJgOOvrCDyhVAHImfPC71wMObymfdDCWDcs0uKDo2bcp RIJAHnmPoC/HeGMfOt8rZczrrQ== X-Received: by 2002:a17:90a:3847:: with SMTP id l7mr19708014pjf.118.1570228033776; Fri, 04 Oct 2019 15:27:13 -0700 (PDT) Received: from localhost.localdomain (104-188-17-28.lightspeed.sndgca.sbcglobal.net. [104.188.17.28]) by smtp.gmail.com with ESMTPSA id x37sm6328136pgl.18.2019.10.04.15.27.12 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 04 Oct 2019 15:27:13 -0700 (PDT) From: Bjorn Andersson To: Ohad Ben-Cohen , Bjorn Andersson Cc: linux-arm-msm@vger.kernel.org, linux-remoteproc@vger.kernel.org, linux-kernel@vger.kernel.org, stable@vger.kernel.org Subject: [PATCH v2 4/6] rpmsg: glink: Fix rpmsg_register_device err handling Date: Fri, 4 Oct 2019 15:27:00 -0700 Message-Id: <20191004222702.8632-5-bjorn.andersson@linaro.org> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20191004222702.8632-1-bjorn.andersson@linaro.org> References: <20191004222702.8632-1-bjorn.andersson@linaro.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Chris Lew The device release function is set before registering with rpmsg. If rpmsg registration fails, the framework will call device_put(), which invokes the release function. The channel create logic does not need to free rpdev if rpmsg_register_device() fails and release is called. Fixes: b4f8e52b89f6 ("rpmsg: Introduce Qualcomm RPM glink driver") Cc: stable@vger.kernel.org Tested-by: Srinivas Kandagatla Signed-off-by: Chris Lew Signed-off-by: Bjorn Andersson --- Changes since v1: - None drivers/rpmsg/qcom_glink_native.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/rpmsg/qcom_glink_native.c b/drivers/rpmsg/qcom_glink_native.c index 21fd2ae5f7f1..89e02baea2d0 100644 --- a/drivers/rpmsg/qcom_glink_native.c +++ b/drivers/rpmsg/qcom_glink_native.c @@ -1423,15 +1423,13 @@ static int qcom_glink_rx_open(struct qcom_glink *glink, unsigned int rcid, ret = rpmsg_register_device(rpdev); if (ret) - goto free_rpdev; + goto rcid_remove; channel->rpdev = rpdev; } return 0; -free_rpdev: - kfree(rpdev); rcid_remove: spin_lock_irqsave(&glink->idr_lock, flags); idr_remove(&glink->rcids, channel->rcid); -- 2.18.0