From patchwork Wed Jul 24 16:28:02 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rhyland Klein X-Patchwork-Id: 261458 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id E43452C007C for ; Thu, 25 Jul 2013 02:28:13 +1000 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754284Ab3GXQ2M (ORCPT ); Wed, 24 Jul 2013 12:28:12 -0400 Received: from hqemgate15.nvidia.com ([216.228.121.64]:13047 "EHLO hqemgate15.nvidia.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753773Ab3GXQ2L (ORCPT ); Wed, 24 Jul 2013 12:28:11 -0400 Received: from hqnvupgp08.nvidia.com (Not Verified[216.228.121.13]) by hqemgate15.nvidia.com id ; Wed, 24 Jul 2013 09:28:05 -0700 Received: from hqemhub02.nvidia.com ([172.20.12.94]) by hqnvupgp08.nvidia.com (PGP Universal service); Wed, 24 Jul 2013 09:27:02 -0700 X-PGP-Universal: processed; by hqnvupgp08.nvidia.com on Wed, 24 Jul 2013 09:27:02 -0700 Received: from rklein-linux.nvidia.com (172.20.144.16) by hqemhub02.nvidia.com (172.20.150.31) with Microsoft SMTP Server (TLS) id 8.3.298.1; Wed, 24 Jul 2013 09:28:10 -0700 From: Rhyland Klein To: Liam Girdwood , Mark Brown CC: Joseph Lo , , , Rhyland Klein Subject: [PATCH] regulator: palmas: fix pdata ptr not be updated after it has been allocated Date: Wed, 24 Jul 2013 12:28:02 -0400 Message-ID: <1374683282-17517-1-git-send-email-rklein@nvidia.com> X-Mailer: git-send-email 1.7.9.5 X-NVConfidentiality: public MIME-Version: 1.0 Sender: linux-tegra-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-tegra@vger.kernel.org The pmic platform data wasn't updated to dev.platform_data after it had been allocated. That can cause the driver crash when using it. This patch fixes the issue. We need to update the pdata pointer at the end of probe because if probe should fail for some reason, for instance if an in-supply isn't ready yet, then probe will defer. However, the pdata is allocated with devm, and so is freed when probe is deferred. Based on work by Joseph Lo. Cc: Joseph Lo Signed-off-by: Rhyland Klein --- drivers/regulator/palmas-regulator.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/regulator/palmas-regulator.c b/drivers/regulator/palmas-regulator.c index d0c8785..e11b762 100644 --- a/drivers/regulator/palmas-regulator.c +++ b/drivers/regulator/palmas-regulator.c @@ -1027,6 +1027,8 @@ static int palmas_regulators_probe(struct platform_device *pdev) } } + /* Store the pdata pointer after everything else passes */ + pdev->dev.platform_data = pdata; return 0;