Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp1992277ybi; Thu, 20 Jun 2019 07:24:21 -0700 (PDT) X-Google-Smtp-Source: APXvYqyJHV8F6ISvdikFJNvTEeferDQMWdX10/89BGHl44hmrdhi/DUU06yT2NsAyA+PCRfVB5u0 X-Received: by 2002:a63:31d1:: with SMTP id x200mr7827941pgx.312.1561040661483; Thu, 20 Jun 2019 07:24:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1561040661; cv=none; d=google.com; s=arc-20160816; b=oI0z0rBpU4md/cX3/5lRlzrE0OZ6IN+huHrHkBPTfRNxKWKR9kKx7Pyfq2wGoUbwNH ws+RjHTBaLTfOIgVT+XV5i1n8eD+7NSow5LTlcQzYRh1veNydM6vJNKavn/jgyPPJ2z7 u8gT4n41G79fX5nRhoNGaBhF7p87qHZI0RW2sEgJ1aZLqgEhWKXPI3xMeYAvUTWDY85N 8ruDWiXCjd4opaXOufOMTjIcC22+M0NoBK+yMGWk9tvLVI6pGGP7lOgUShAIaNcXDkBT cpKcGm3do4mbjVwwORQLGwJu0bHQoxzmWVAFBOYG+X1DKKuV0h6HsbbY45AxSsitKurt P6XA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dkim-signature; bh=+UzUbDRAaaNqwrtJOvlpRknxT3IijEX1YVPa5qy2MtM=; b=hc5mVkVb66mTysYYsq+7n2DxXpbiN1Jkq2wG4dpysHvqLcFECCUZOvZtwclrwJifEf HYkXhnOPBaAUplLwHu9CvdrpHnY6f8bjkNWC7DvnFBAzY+8zfHBwdJg5qNxnDnJasygJ OaRjYJdToaqEepjcYWkNXTJ1fhfySK0HgZL7GO1MJlgY+pysm3Kt+HjfJCD0/s31Vti+ /LCwc3r1sfXGJCnrM47hTIi6J9JDJTQpXiFxb6KUo52YTlBAaRAmCP7nNmNgKRPDVicQ 2tQyUDAnxIt9E4USLGEFFoAtNheKbvanaB+uIf1MNjDDaNcRybEGcaFEbsPp1VYWdcM9 g/Vg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=CVLcV+OS; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 3si18832949pli.12.2019.06.20.07.24.05; Thu, 20 Jun 2019 07:24:21 -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=@gmail.com header.s=20161025 header.b=CVLcV+OS; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732022AbfFTOWi (ORCPT + 99 others); Thu, 20 Jun 2019 10:22:38 -0400 Received: from mail-pg1-f194.google.com ([209.85.215.194]:46659 "EHLO mail-pg1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731226AbfFTOWi (ORCPT ); Thu, 20 Jun 2019 10:22:38 -0400 Received: by mail-pg1-f194.google.com with SMTP id v9so1652489pgr.13; Thu, 20 Jun 2019 07:22:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=+UzUbDRAaaNqwrtJOvlpRknxT3IijEX1YVPa5qy2MtM=; b=CVLcV+OS1EoECdFxLm6kqQH5hyOWXfLAQTcbmJfoV8uhVPelXUNHU17+dRpDf9Imvy xLQSiRMssA7fqybdSgQ+CL/1jTHEBJ8671OlEROL3mRHI1oRq8ETGUNYAjtmWQI1KTxN 0ICPLA378wp/hRV6KKBbF8jStbt2es0FYkGEgv6TI2IoiazQeyylKOUtBLQHRS2f0BqZ aJ4+z/WYGX0TsK39dX0sQ9aX/B4jhu+qwmQ/T8uLuLS9MBboSd5JoPOdm1K9SEW5Ui27 Xvj/0YMdpPhv48a/cC7NKRXPjM4qrGLF0oQoDn80zYtvIhkZZk+yXVm8qaF6EHlHZF/G Y4uQ== 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; bh=+UzUbDRAaaNqwrtJOvlpRknxT3IijEX1YVPa5qy2MtM=; b=ewXdY6PCfOCJu+21TablLONfJc/Dh+Pg8L+39vO5mz7EfEbB4bmFrlsxaH8nF5v4OO vyIiMqUBZKrgzfEPYJvJj7eesHyv/l4lVbQYodOFwE/z9nR/QzdCxcR4Tmutwg2nXwQN a/hrNYdxckL6YN2MlO4E7ayvbb6kZ7KR8IAUSZZJOdXW4GBt+eLVtcZ8TWffByf+BrL3 sHfrKFwD61AouZyujjsHGKNWajW59NSoByrb4eF/mFwduMsbanbhf1zaGQyulEURbmqR Qd0r93Gt/qiy+vLbRjzRi9f34OVphi88Ep2r9z0elopW9OiyS7tmeAviqbeg5asr6y1i cHmA== X-Gm-Message-State: APjAAAWWFkvskXCmtgOp1pP3Aa7PrIyN6+I7EA839RID86nzvEUZjelW DtULGF++a/LTN+tagFc+O+LFsohr X-Received: by 2002:a17:90a:cf8f:: with SMTP id i15mr3256035pju.110.1561040557622; Thu, 20 Jun 2019 07:22:37 -0700 (PDT) Received: from aw-bldr-10.qualcomm.com (i-global254.qualcomm.com. [199.106.103.254]) by smtp.gmail.com with ESMTPSA id 16sm22516557pfo.65.2019.06.20.07.22.35 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 20 Jun 2019 07:22:37 -0700 (PDT) From: Jeffrey Hugo To: bjorn.andersson@linaro.org, lgirdwood@gmail.com, broonie@kernel.org, jorge.ramirez-ortiz@linaro.org Cc: linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, Jeffrey Hugo Subject: [PATCH] regulator: qcom_spmi: Do NULL check for lvs Date: Thu, 20 Jun 2019 07:22:28 -0700 Message-Id: <20190620142228.11773-1-jeffrey.l.hugo@gmail.com> X-Mailer: git-send-email 2.17.1 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Low-voltage switches (lvs) don't have set_points since the voltage ranges of the output are really controlled by the inputs. This is a problem for the newly added linear range support in the probe(), as that will cause a null pointer dereference error on older platforms like msm8974 which happen to need to control some of the implemented lvs. Fix this by adding the appropriate null check. Fixes: 86f4ff7a0c0c ("regulator: qcom_spmi: enable linear range info") Reported-by: Bjorn Andersson Signed-off-by: Jeffrey Hugo --- drivers/regulator/qcom_spmi-regulator.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/regulator/qcom_spmi-regulator.c b/drivers/regulator/qcom_spmi-regulator.c index 877df33e0246..7f51c5fc8194 100644 --- a/drivers/regulator/qcom_spmi-regulator.c +++ b/drivers/regulator/qcom_spmi-regulator.c @@ -2045,7 +2045,7 @@ static int qcom_spmi_regulator_probe(struct platform_device *pdev) } } - if (vreg->set_points->count == 1) { + if (vreg->set_points && vreg->set_points->count == 1) { /* since there is only one range */ range = vreg->set_points->range; vreg->desc.uV_step = range->step_uV; -- 2.17.1