Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp3097192ybi; Thu, 18 Jul 2019 20:59:02 -0700 (PDT) X-Google-Smtp-Source: APXvYqxhvEl2Qk7sa3a1EAeO1apwRiNMQD29cRfGLnMNQYtgjVvg61fp2oNEvtJluQ2picpZ40Ay X-Received: by 2002:a63:b102:: with SMTP id r2mr50992952pgf.370.1563508742588; Thu, 18 Jul 2019 20:59:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1563508742; cv=none; d=google.com; s=arc-20160816; b=jhWldxk66l+lDSik++1gdReSVijGhfMY2eQxQpcipT4LT+BrLySM6Y+S/62DfzWMtU u7UIW1gbnqSmDmf8sHCrr0bwiWPKRx5Gfxi2+uG/98hgLkcfLf9AtkzU1EccQSEm9N8H QLTrxDTRELIsGPMY+enyjutdvc3vBx3z9nU/R2TPzycwSAlVL9Iubyb1cRl+4Cw+BPrv nf83DsqZDsfhXPT6xo2GMa2JPkJFPcT3xsFcNIxgzAznNM/57F2b9BwDhAbhbvPxUHOL QnGzSyP/NU0/Tl0yizc7wzeYzfeorzFzYSR18ifYfzZw7LF64hApQz4bkhq21DYtHhf/ Nqsw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=Pxzh42j95ZO4VHVgFUJUVQ/9uMg19MOlc+OFj0IG+MU=; b=gG44esle1GOUMsK4hSY615cp81NHEeaKe9I/lH9fyKVM3b4TDAnJyrMSlLqVoA4C9M 15XanueBfTzG70yvFtefm+LleXyvK1daLwKVBbfo0SMSYSde66xNUjQvpDLBcaOAUyZc WuHEZJJBsiJi6Kx8vD+6tjbztowySu9esTDlEoGsyBS2hskg+BYaiWMCCCIK84WltoR4 lrUltTfoX1n97IC36meHBDWkkY12jJT0TOLMt2a0I+p23Q2MnPI8snFPvdNIk3OzQF7L xNAePutdXtf5fpbs4w2dngKmluf3zF1g2PqgUtM8ajRaOnn3mVW/NaWqbAPjWofsHQCv 5z8A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=iAF4jKVl; 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=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c8si689560pfo.42.2019.07.18.20.58.47; Thu, 18 Jul 2019 20:59:02 -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=@kernel.org header.s=default header.b=iAF4jKVl; 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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726980AbfGSD5E (ORCPT + 99 others); Thu, 18 Jul 2019 23:57:04 -0400 Received: from mail.kernel.org ([198.145.29.99]:56238 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726829AbfGSD5B (ORCPT ); Thu, 18 Jul 2019 23:57:01 -0400 Received: from sasha-vm.mshome.net (c-73-47-72-35.hsd1.nh.comcast.net [73.47.72.35]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 607822082E; Fri, 19 Jul 2019 03:57:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1563508621; bh=zMKnazpAF4OC5FetD91mPIJFHI0i25tXLO3dsyYyssI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=iAF4jKVl1NFzd0OqVx42b4wpTl3ndEoeEXcN+IVv+N6TacQS5N2/5Yl2q97/oVXy3 +LcM4IKZ/S1rFqLlgrkfh2CVWQF1kFsLM6W8Ma6qjl2YaIlqmup15kud6FOW0JnU9G lDHPYTkGvRjh1xIgbZfL/3h/SuyfgGoKnCOde5ZU= From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Jeremy Sowden , Dan Carpenter , Greg Kroah-Hartman , Sasha Levin , devel@driverdev.osuosl.org Subject: [PATCH AUTOSEL 5.2 006/171] staging: kpc2000: added missing clean-up to probe_core_uio. Date: Thu, 18 Jul 2019 23:53:57 -0400 Message-Id: <20190719035643.14300-6-sashal@kernel.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190719035643.14300-1-sashal@kernel.org> References: <20190719035643.14300-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Jeremy Sowden [ Upstream commit abb611d2c21c0a4fa8eab35dc936c80d9a07acd8 ] On error, probe_core_uio just returned an error without freeing resources which had previously been allocated. Added the missing clean-up code. Updated TODO. Signed-off-by: Jeremy Sowden Reviewed-by: Dan Carpenter Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin --- drivers/staging/kpc2000/TODO | 1 - drivers/staging/kpc2000/kpc2000/cell_probe.c | 3 +++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/staging/kpc2000/TODO b/drivers/staging/kpc2000/TODO index 8c7af29fefae..ed951acc829a 100644 --- a/drivers/staging/kpc2000/TODO +++ b/drivers/staging/kpc2000/TODO @@ -1,7 +1,6 @@ - the kpc_spi driver doesn't seem to let multiple transactions (to different instances of the core) happen in parallel... - The kpc_i2c driver is a hot mess, it should probably be cleaned up a ton. It functions against current hardware though. - pcard->card_num in kp2000_pcie_probe() is a global variable and needs atomic / locking / something better. -- probe_core_uio() probably needs error handling - the loop in kp2000_probe_cores() that uses probe_core_uio() also probably needs error handling - would be nice if the AIO fileops in kpc_dma could be made to work - probably want to add a CONFIG_ option to control compilation of the AIO functions diff --git a/drivers/staging/kpc2000/kpc2000/cell_probe.c b/drivers/staging/kpc2000/kpc2000/cell_probe.c index e0dba91e7fa8..d6b57f550876 100644 --- a/drivers/staging/kpc2000/kpc2000/cell_probe.c +++ b/drivers/staging/kpc2000/kpc2000/cell_probe.c @@ -295,6 +295,7 @@ int probe_core_uio(unsigned int core_num, struct kp2000_device *pcard, char *na kudev->dev = device_create(kpc_uio_class, &pcard->pdev->dev, MKDEV(0,0), kudev, "%s.%d.%d.%d", kudev->uioinfo.name, pcard->card_num, cte.type, kudev->core_num); if (IS_ERR(kudev->dev)) { dev_err(&pcard->pdev->dev, "probe_core_uio device_create failed!\n"); + kfree(kudev); return -ENODEV; } dev_set_drvdata(kudev->dev, kudev); @@ -302,6 +303,8 @@ int probe_core_uio(unsigned int core_num, struct kp2000_device *pcard, char *na rv = uio_register_device(kudev->dev, &kudev->uioinfo); if (rv){ dev_err(&pcard->pdev->dev, "probe_core_uio failed uio_register_device: %d\n", rv); + put_device(kudev->dev); + kfree(kudev); return rv; } -- 2.20.1