From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S942517AbcJ1SQd (ORCPT ); Fri, 28 Oct 2016 14:16:33 -0400 Received: from mx1.redhat.com ([209.132.183.28]:37788 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S935364AbcJ1SP6 (ORCPT ); Fri, 28 Oct 2016 14:15:58 -0400 Subject: Re: [PATCH v2] phy: sun4i: check PMU presence when poking unknown bit of pmu To: icenowy@aosc.xyz, Kishon Vijay Abraham I , Maxime Ripard , Chen-Yu Tsai References: <20161028162701.4531-1-icenowy@aosc.xyz> Cc: linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-sunxi@googlegroups.com From: Hans de Goede Message-ID: <41f43381-c1bb-2f69-5f99-ac5cebf651ea@redhat.com> Date: Fri, 28 Oct 2016 20:15:53 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.4.0 MIME-Version: 1.0 In-Reply-To: <20161028162701.4531-1-icenowy@aosc.xyz> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Fri, 28 Oct 2016 18:15:57 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi, On 28-10-16 18:27, Icenowy Zheng wrote: > Allwinner SoC's PHY 0, when used as OTG controller, have no pmu part. > The code that poke some unknown bit of PMU for H3/A64 didn't check > the PHY, and will cause kernel oops when PHY 0 is used. > > This patch will check whether the pmu is not NULL before poking. > > Fixes: b3e0d141ca9f (phy: sun4i: add support for A64 usb phy) > > Signed-off-by: Icenowy Zheng > Acked-by: Maxime Ripard Patch LGTM too: Reviewed-by: Hans de Goede Regards, Hans > --- > drivers/phy/phy-sun4i-usb.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/phy/phy-sun4i-usb.c b/drivers/phy/phy-sun4i-usb.c > index b9342a2..fec34f5 100644 > --- a/drivers/phy/phy-sun4i-usb.c > +++ b/drivers/phy/phy-sun4i-usb.c > @@ -264,7 +264,7 @@ static int sun4i_usb_phy_init(struct phy *_phy) > return ret; > } > > - if (data->cfg->enable_pmu_unk1) { > + if (phy->pmu && data->cfg->enable_pmu_unk1) { > val = readl(phy->pmu + REG_PMU_UNK1); > writel(val & ~2, phy->pmu + REG_PMU_UNK1); > } >