From patchwork Thu May 1 18:56:47 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Brown X-Patchwork-Id: 29528 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-pa0-f69.google.com (mail-pa0-f69.google.com [209.85.220.69]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 210F320675 for ; Thu, 1 May 2014 18:57:25 +0000 (UTC) Received: by mail-pa0-f69.google.com with SMTP id hz1sf16929415pad.8 for ; Thu, 01 May 2014 11:57:24 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:date :message-id:subject:sender:precedence:list-id:x-original-sender :x-original-authentication-results:mailing-list:list-post:list-help :list-archive:list-unsubscribe; bh=/JRbvNpuGxWUlilueIBbJqb8kwmETdAbDbjPwSEUcU0=; b=CyncVAKYqC3jDlCHL/wJtNTq/atoGbgQW3bStWm5DPxS8REbg9mvLNxUmo0bBiEH3Y PovgRPXCsOU/yfVpKxs3Y6O7OPw1AE9ize5wMJ+UMBTsVNaG4NnploymfLpjmXTbRy7Z 2GN0EaHANnAMvze1aviF1t6CaM9k4O1XJOHORckVsqODh0srMFIpJ4okSGuh5OZzvGLk ZFUX2ZkunDLysYmMQCa9DYlChqhGKCKxt0uEiq7ftnmm55LMmTAXWCNu91TTD8L7DdXD Qiehks7Ygqq1R/fGIzuH5eFUN8OaA9aJmVSiwJfFYJ4pOi23qsv1rNgF4CZx7zW1v+6B O1YQ== X-Gm-Message-State: ALoCoQmMNPsMu3kKvQQg0JVqsVIfdJeoVwmsipjRcJwjJcjgjIoiIej5L6S+d3NWOa8EcePizynW X-Received: by 10.66.251.70 with SMTP id zi6mr6252046pac.37.1398970644092; Thu, 01 May 2014 11:57:24 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.47.10 with SMTP id l10ls1205002qga.4.gmail; Thu, 01 May 2014 11:57:23 -0700 (PDT) X-Received: by 10.58.186.71 with SMTP id fi7mr890645vec.32.1398970643942; Thu, 01 May 2014 11:57:23 -0700 (PDT) Received: from mail-ve0-f179.google.com (mail-ve0-f179.google.com [209.85.128.179]) by mx.google.com with ESMTPS id j20si6218053vcx.19.2014.05.01.11.57.23 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 01 May 2014 11:57:23 -0700 (PDT) Received-SPF: none (google.com: patch+caf_=patchwork-forward=linaro.org@linaro.org does not designate permitted sender hosts) client-ip=209.85.128.179; Received: by mail-ve0-f179.google.com with SMTP id oy12so1449485veb.10 for ; Thu, 01 May 2014 11:57:23 -0700 (PDT) X-Received: by 10.52.13.41 with SMTP id e9mr870711vdc.21.1398970643865; Thu, 01 May 2014 11:57:23 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.220.221.72 with SMTP id ib8csp46576vcb; Thu, 1 May 2014 11:57:23 -0700 (PDT) X-Received: by 10.66.192.225 with SMTP id hj1mr24179189pac.142.1398970643038; Thu, 01 May 2014 11:57:23 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id si6si21571957pab.285.2014.05.01.11.57.22 for ; Thu, 01 May 2014 11:57:22 -0700 (PDT) Received-SPF: none (google.com: linux-kernel-owner@vger.kernel.org does not designate permitted sender hosts) client-ip=209.132.180.67; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751884AbaEAS5O (ORCPT + 28 others); Thu, 1 May 2014 14:57:14 -0400 Received: from mezzanine.sirena.org.uk ([106.187.55.193]:54374 "EHLO mezzanine.sirena.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751535AbaEAS5M (ORCPT ); Thu, 1 May 2014 14:57:12 -0400 Received: from [209.133.115.210] (helo=finisterre) by mezzanine.sirena.org.uk with esmtpsa (TLS1.2:RSA_AES_128_CBC_SHA1:128) (Exim 4.80) (envelope-from ) id 1WfwAK-0004VB-Cx; Thu, 01 May 2014 18:57:08 +0000 Received: from broonie by finisterre with local (Exim 4.82) (envelope-from ) id 1WfwA7-0006g0-1l; Thu, 01 May 2014 11:56:51 -0700 From: Mark Brown To: Olof Johansson , Doug Anderson , Liam Girdwood Cc: linux-kernel@vger.kernel.org, linaro-kernel@lists.linaro.org, Mark Brown Date: Thu, 1 May 2014 11:56:47 -0700 Message-Id: <1398970607-25623-1-git-send-email-broonie@kernel.org> X-Mailer: git-send-email 1.9.2 X-SA-Exim-Connect-IP: 209.133.115.210 X-SA-Exim-Mail-From: broonie@sirena.org.uk X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on mezzanine.sirena.org.uk X-Spam-Level: X-Spam-Status: No, score=-2.9 required=5.0 tests=ALL_TRUSTED,BAYES_00 autolearn=ham version=3.3.2 Subject: [PATCH] regulator: tps65090: Check for pdata before dereferencing X-SA-Exim-Version: 4.2.1 (built Mon, 26 Dec 2011 16:24:06 +0000) X-SA-Exim-Scanned: Yes (on mezzanine.sirena.org.uk) Sender: linux-kernel-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: broonie@kernel.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: patch+caf_=patchwork-forward=linaro.org@linaro.org does not designate permitted sender hosts) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , From: Mark Brown The per-regulator pdata is optional so we need to check that it's there before dereferencing it. This wasn't done in "regulator: tps65090: Allow setting the overcurrent wait time", fix that. Reported-by: Olof Johansson Signed-off-by: Mark Brown --- drivers/regulator/tps65090-regulator.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/drivers/regulator/tps65090-regulator.c b/drivers/regulator/tps65090-regulator.c index ca04e9f..fbe0bf5 100644 --- a/drivers/regulator/tps65090-regulator.c +++ b/drivers/regulator/tps65090-regulator.c @@ -306,8 +306,11 @@ static int tps65090_regulator_probe(struct platform_device *pdev) ri = &pmic[num]; ri->dev = &pdev->dev; ri->desc = &tps65090_regulator_desc[num]; - ri->overcurrent_wait_valid = tps_pdata->overcurrent_wait_valid; - ri->overcurrent_wait = tps_pdata->overcurrent_wait; + if (tps_pdata) { + ri->overcurrent_wait_valid = + tps_pdata->overcurrent_wait_valid; + ri->overcurrent_wait = tps_pdata->overcurrent_wait; + } /* * TPS5090 DCDC support the control from external digital input.