From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S966466AbcAZPOU (ORCPT ); Tue, 26 Jan 2016 10:14:20 -0500 Received: from mx0a-001ae601.pphosted.com ([67.231.149.25]:35721 "EHLO mx0a-001ae601.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932442AbcAZPOR (ORCPT ); Tue, 26 Jan 2016 10:14:17 -0500 Authentication-Results: ppops.net; spf=none smtp.mail=ckeepax@opensource.wolfsonmicro.com From: Charles Keepax To: CC: , , Subject: [PATCH] regulator: core: Clear constraints pointer after free on error path Date: Tue, 26 Jan 2016 15:14:16 +0000 Message-ID: <1453821256-28179-1-git-send-email-ckeepax@opensource.wolfsonmicro.com> X-Mailer: git-send-email 2.1.4 MIME-Version: 1.0 Content-Type: text/plain X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 suspectscore=3 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1507310008 definitions=main-1601260274 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org As we now free the constraints in regulator_dev_release we will still call free on the constraints pointer even if we went down an error path in regulator_register, as such we need to clear to the pointer to ensure the kfree in regulator_dev_release is a no-op. Fixes: 29f5f4860a8e ("regulator: core: Move more deallocation into class unregister") Signed-off-by: Charles Keepax --- drivers/regulator/core.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c index 744c988..a7936ab 100644 --- a/drivers/regulator/core.c +++ b/drivers/regulator/core.c @@ -3980,6 +3980,7 @@ unset_supplies: scrub: regulator_ena_gpio_free(rdev); kfree(rdev->constraints); + rdev->constraints = NULL; wash: device_unregister(&rdev->dev); /* device core frees rdev */ -- 2.1.4