Received: by 10.213.65.68 with SMTP id h4csp1360439imn; Mon, 19 Mar 2018 01:49:07 -0700 (PDT) X-Google-Smtp-Source: AG47ELu/fjokevALklhrx1bqcq5FuHV/al5bi58V90yOqM/T2IcwN2ax27qH5Yu4qvO65KFC5kCw X-Received: by 10.99.97.149 with SMTP id v143mr8530442pgb.319.1521449347402; Mon, 19 Mar 2018 01:49:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521449347; cv=none; d=google.com; s=arc-20160816; b=VbKKs5w2FKd4m6v8tWnRmuDJIG0NckeLwG6VsP+O0HMNKoD2AyPW0bfRj7jCX4B/mw qn76vGSb7YXJ8m6AGjScS5fdQ6nttwsWeG6fGOwaLeX+yPCl1yjxVfu+iVnq4IDXnesU fjrt6xjD/O3Zkrh5jc7tQiBkfG5co64hi+RibG3a2HhwUemfEHFLtcWXLLndlYAfKCL4 b2CMJKueUm3AVJRT+DfyqImgPdVLac3VHrNujPzYayP1i8DV+5gkIdmL06Ud/2GL7bYC RaldIOtOhBP31BkBtp+8dIzTy4iau/taMKYtXhUdHz12SmgPC5HtvmyT3bkEduXK2jDk 7Enw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:message-id:references :in-reply-to:subject:cc:to:from:date:content-transfer-encoding :mime-version:dkim-signature:dkim-signature :arc-authentication-results; bh=gBPCdduUfFuWCQYxD6iFCWhu5tTolQjIURrN8Cy0Yns=; b=novsZTcPdRwgDFUs3SWnieaIwNxiWy4wRWqgIDrDZl5xxMbgaiDuu6Z8mmAzQ2mbna OkZ8Eu9Rs1UiAQSDSD0qyV44SjHG2z1abeyqPgWIO0ioITB6SW1LktdhbkDP5HwRrz07 yyq1+ZqJ9QAiJOtK0hhq6fTLOgCWPVLfNvPV1a/kfJ7d1QECXqahSbUOaLzcdNTHhUFH Us/ykFGyVovDUSSkdH1cAtVifbEm2maLgiwPSdVCgs2qYTNDXB1XNI7XupRNG6PH/nK6 UN8g5m2t8EyJRKH6HnYTur6YOXpBGMspllsX+YvwtopiESeoorJYk4c2QL/E/s1WAimo qbgw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@codeaurora.org header.s=default header.b=AOUsvSOs; dkim=pass header.i=@codeaurora.org header.s=default header.b=AOUsvSOs; 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 g6-v6si2967630plt.580.2018.03.19.01.48.52; Mon, 19 Mar 2018 01:49: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=AOUsvSOs; dkim=pass header.i=@codeaurora.org header.s=default header.b=AOUsvSOs; 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 S932767AbeCSIr0 (ORCPT + 99 others); Mon, 19 Mar 2018 04:47:26 -0400 Received: from smtp.codeaurora.org ([198.145.29.96]:58448 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754531AbeCSIrX (ORCPT ); Mon, 19 Mar 2018 04:47:23 -0400 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id C1D22607E4; Mon, 19 Mar 2018 08:47:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1521449242; bh=vdymAMVgTmxx0nZdQUCH8bK1xFBXPObSeheuKi8OhFo=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=AOUsvSOsiAKa8Fo+du5e65EgKbbE8Bdr9Q832S5fCNM7EyGlqR5PQZcCaKCLrRkg6 25pTTo2CuAhtTBsRzArrxsz4Nta+ywgNa28CYYC2/TFnWuWsaphb1432MujSj2v+j/ uV2OHb1TNBu9eSd+lVlqSLsI4lKePq6VnlE1p2FQ= 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 mail.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.codeaurora.org (Postfix) with ESMTP id 78A506055B; Mon, 19 Mar 2018 08:47:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1521449242; bh=vdymAMVgTmxx0nZdQUCH8bK1xFBXPObSeheuKi8OhFo=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=AOUsvSOsiAKa8Fo+du5e65EgKbbE8Bdr9Q832S5fCNM7EyGlqR5PQZcCaKCLrRkg6 25pTTo2CuAhtTBsRzArrxsz4Nta+ywgNa28CYYC2/TFnWuWsaphb1432MujSj2v+j/ uV2OHb1TNBu9eSd+lVlqSLsI4lKePq6VnlE1p2FQ= MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit Date: Mon, 19 Mar 2018 14:17:22 +0530 From: Vivek Gautam To: Manu Gautam Cc: Kishon Vijay Abraham I , linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-msm-owner@vger.kernel.org Subject: Re: [PATCH] phy: core: Allow phy_pm_runtime_xxx API calls with NULL phy In-Reply-To: <1521191452-30089-1-git-send-email-mgautam@codeaurora.org> References: <1521191452-30089-1-git-send-email-mgautam@codeaurora.org> Message-ID: X-Sender: vivek.gautam@codeaurora.org User-Agent: Roundcube Webmail/1.2.5 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2018-03-16 14:40, Manu Gautam wrote: > phy_init() and phy_exit() calls, and phy_power_on() and > phy_power_off() already accept NULL as valid PHY refernece > and act as NOP. Extend same concept to phy runtime_pm APIs > to keep drivers (e.g. dwc3) code simple while dealing with > optional PHYs. > > Signed-off-by: Manu Gautam > --- > drivers/phy/phy-core.c | 18 ++++++++++++++++++ > 1 file changed, 18 insertions(+) > > diff --git a/drivers/phy/phy-core.c b/drivers/phy/phy-core.c > index 09ac8af..48b9615 100644 > --- a/drivers/phy/phy-core.c > +++ b/drivers/phy/phy-core.c > @@ -153,6 +153,9 @@ int phy_pm_runtime_get(struct phy *phy) > { > int ret; > > + if (!phy) > + return 0; > + > if (!pm_runtime_enabled(&phy->dev)) Were we already trying to dereference a NULL here? That shouldn't be good i guess. Kishon, do we not expect phys to be NULL here? regards Vivek