Received: by 10.192.165.148 with SMTP id m20csp1099349imm; Wed, 2 May 2018 14:09:07 -0700 (PDT) X-Google-Smtp-Source: AB8JxZpGCEnaNzghBKYY9Ultyn7wwfxJM3JnEDVnbimEZ5xIzZDWxGoH/EeL2NLF7S5B7KSmYsAn X-Received: by 2002:a63:5ec5:: with SMTP id s188-v6mr17268773pgb.21.1525295347666; Wed, 02 May 2018 14:09:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1525295347; cv=none; d=google.com; s=arc-20160816; b=cA3yfTHcwLqmnEVx7O0elKeCKORPLn/fsmBylgc0n5CicGSVLQDA0fuOby/swlnjf1 DBMOY2MxbrntsTu0+1gi9I0d5/4vP4LsJe+3gNHMO7sfwCrwWzAvrSC5nd/3OZLwur/g GkMmUqoe9DW7U0TFN99pxQIfpjIo4bQYNIJLH+1rDLTpfFgfv/RwW4wJ2NWH+CjxYaxn GFOaq5+cHl4D5V60fzK//UCDC6meS8NHfuHusOG1QlZbykTU5sbHMYtMebNN9X4ZqlZv VuiBTftdh9czW6F/mSb6d6XZh4VwRdHIvUCakS7MJlwaA95agNpsk/AG+4159rThP9kp 5z1Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dmarc-filter:dkim-signature:dkim-signature :arc-authentication-results; bh=q2nJnVCCMQktDubYQ0edsCwAphGmRPG5GkTvt+PauBY=; b=HbsCsackAWT3IswNf20tZHr+ufIaw2yVqBRIRRfzVey/JlEbbBgBbj3Y+ZGgXDvDbp /3Nf4Zl0y9RqXV2bTz5Ed/URuW43wnyMI1Z2x165EFHfph0+RqgwjFkLGXwOeEXSQlRq z9rntnrtI4HWyuUeq0p5BWbIfi55XFUE0QpJt50e9CDTjtv5iByM9Xpsv+Ih4OkS3M/c pTXx6DLbIqm1KR8tMyQT+224EQVZ1HhTnrrcoVwZhnvvCTLJcYzQ2sUTFrDPDMFOLTBt S3Sp6LB5n4EiBzSOPXEwYU6ge7l8fL8jmILMLu7zQJC346aC0BHXVJyhZdNz1+gWA8Ze smEA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@codeaurora.org header.s=default header.b=MVKpCW50; dkim=pass header.i=@codeaurora.org header.s=default header.b=I34S0OlB; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f25-v6si9936080pgv.47.2018.05.02.14.08.53; Wed, 02 May 2018 14:09:07 -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=@codeaurora.org header.s=default header.b=MVKpCW50; dkim=pass header.i=@codeaurora.org header.s=default header.b=I34S0OlB; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751903AbeEBVII (ORCPT + 99 others); Wed, 2 May 2018 17:08:08 -0400 Received: from smtp.codeaurora.org ([198.145.29.96]:59664 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751470AbeEBVGp (ORCPT ); Wed, 2 May 2018 17:06:45 -0400 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id 8D82560310; Wed, 2 May 2018 21:06:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1525295204; bh=wY1u/y7YYuZyKb5K1mf2Z6OpsGfhhFaI8QOi9PLKQfo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=MVKpCW507I1QpLlKyNXFvltXoAswAg8WzRQeO5abshRBEehlyhSi0ddyjh+ZzWg0z Wf5HbcG/88dQkzSIdyghgQ56iV8POHXkUd3yIJGLyCEPvbNnHqEyBk5Jt33uC3VXGP p3/SQjCJ5r7ti3/uZQLsGU52i1iBcGBhOnxs52R8= X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on pdx-caf-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.8 required=2.0 tests=ALL_TRUSTED,BAYES_00, DKIM_SIGNED,T_DKIM_INVALID autolearn=no autolearn_force=no version=3.4.0 Received: from mgautam-linux.qualcomm.com (blr-c-bdr-fw-01_globalnat_allzones-outside.qualcomm.com [103.229.19.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: mgautam@smtp.codeaurora.org) by smtp.codeaurora.org (Postfix) with ESMTPSA id 098766090E; Wed, 2 May 2018 21:06:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1525295203; bh=wY1u/y7YYuZyKb5K1mf2Z6OpsGfhhFaI8QOi9PLKQfo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=I34S0OlBpQoD1Qm8T4Oghl+leIqoPqIvLmZy9MZPDa8CE+/7EjOv53qaN5im4RsdH bZ5YwRrSWTYx5kqAXMPvmguvQBiyq6WQJB+631uYZ/HU+tghzCLu1RS+WKtJxzLxVG /fClLjElkC6M17YDYgrr4T5T4yFMRO34sYVAiEF0= DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org 098766090E Authentication-Results: pdx-caf-mail.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: pdx-caf-mail.web.codeaurora.org; spf=none smtp.mailfrom=mgautam@codeaurora.org From: Manu Gautam To: Kishon Vijay Abraham I , robh@kernel.org, sboyd@kernel.org Cc: devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, dianders@chromium.org, evgreen@chromium.org, Vivek Gautam , linux-arm-msm@vger.kernel.org, linux-usb@vger.kernel.org, Manu Gautam , stable Subject: [PATCH v5 3/7] phy: qcom-qusb2: Fix crash if nvmem cell not specified Date: Thu, 3 May 2018 02:36:10 +0530 Message-Id: <1525295174-15995-4-git-send-email-mgautam@codeaurora.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1525295174-15995-1-git-send-email-mgautam@codeaurora.org> References: <1525295174-15995-1-git-send-email-mgautam@codeaurora.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Driver currently crashes due to NULL pointer deference while updating PHY tune register if nvmem cell is NULL. Since, fused value for Tune1/2 register is optional, we'd rather bail out. Fixes: ca04d9d3e1b1 ("phy: qcom-qusb2: New driver for QUSB2 PHY on Qcom chips") Reviewed-by: Vivek Gautam Reviewed-by: Evan Green Cc: stable # 4.14+ Signed-off-by: Manu Gautam --- drivers/phy/qualcomm/phy-qcom-qusb2.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/phy/qualcomm/phy-qcom-qusb2.c b/drivers/phy/qualcomm/phy-qcom-qusb2.c index 94afeac..40fdef8 100644 --- a/drivers/phy/qualcomm/phy-qcom-qusb2.c +++ b/drivers/phy/qualcomm/phy-qcom-qusb2.c @@ -315,6 +315,10 @@ static void qusb2_phy_set_tune2_param(struct qusb2_phy *qphy) const struct qusb2_phy_cfg *cfg = qphy->cfg; u8 *val; + /* efuse register is optional */ + if (!qphy->cell) + return; + /* * Read efuse register having TUNE2/1 parameter's high nibble. * If efuse register shows value as 0x0, or if we fail to find -- The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project