Message ID | 20200728022756.87687-1-miaoqinglang@huawei.com (mailing list archive) |
---|---|
State | Accepted |
Commit | 12b7b5c04bccc82db74f7c0de8e2d2b93d27cebf |
Headers | show |
Series | [-next] ARM: s3c: fix return value check in s3c_usb_otgphy_init() | expand |
On Tue, Jul 28, 2020 at 10:27:56AM +0800, Qinglang Miao wrote: > the function clk_get() returns ERR_PTR() in case of error and > never returns NULL. So there's no need to test whether xusbxti > is NULL, just remove the redundant part in the return value check. > > Signed-off-by: Qinglang Miao <miaoqinglang@huawei.com> > --- > arch/arm/mach-s3c64xx/setup-usb-phy.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) Looks good, thanks. I don't plan to take anything before merge window (it is quite late in the cycle) so I will apply it after the window. Best regards, Krzysztof > diff --git a/arch/arm/mach-s3c64xx/setup-usb-phy.c b/arch/arm/mach-s3c64xx/setup-usb-phy.c > index d6b0e3b26..99d743884 100644 > --- a/arch/arm/mach-s3c64xx/setup-usb-phy.c > +++ b/arch/arm/mach-s3c64xx/setup-usb-phy.c > @@ -31,7 +31,7 @@ static int s3c_usb_otgphy_init(struct platform_device *pdev) > phyclk = readl(S3C_PHYCLK) & ~S3C_PHYCLK_CLKSEL_MASK; > > xusbxti = clk_get(&pdev->dev, "xusbxti"); > - if (xusbxti && !IS_ERR(xusbxti)) { > + if (!IS_ERR(xusbxti)) { > switch (clk_get_rate(xusbxti)) { > case 12 * MHZ: > phyclk |= S3C_PHYCLK_CLKSEL_12M; > -- > 2.25.1 >
On Tue, Jul 28, 2020 at 10:27:56AM +0800, Qinglang Miao wrote: > the function clk_get() returns ERR_PTR() in case of error and > never returns NULL. So there's no need to test whether xusbxti > is NULL, just remove the redundant part in the return value check. > > Signed-off-by: Qinglang Miao <miaoqinglang@huawei.com> > --- > arch/arm/mach-s3c64xx/setup-usb-phy.c | 2 +- Thanks, applied. Best regards, Krzysztof
diff --git a/arch/arm/mach-s3c64xx/setup-usb-phy.c b/arch/arm/mach-s3c64xx/setup-usb-phy.c index d6b0e3b26..99d743884 100644 --- a/arch/arm/mach-s3c64xx/setup-usb-phy.c +++ b/arch/arm/mach-s3c64xx/setup-usb-phy.c @@ -31,7 +31,7 @@ static int s3c_usb_otgphy_init(struct platform_device *pdev) phyclk = readl(S3C_PHYCLK) & ~S3C_PHYCLK_CLKSEL_MASK; xusbxti = clk_get(&pdev->dev, "xusbxti"); - if (xusbxti && !IS_ERR(xusbxti)) { + if (!IS_ERR(xusbxti)) { switch (clk_get_rate(xusbxti)) { case 12 * MHZ: phyclk |= S3C_PHYCLK_CLKSEL_12M;
the function clk_get() returns ERR_PTR() in case of error and never returns NULL. So there's no need to test whether xusbxti is NULL, just remove the redundant part in the return value check. Signed-off-by: Qinglang Miao <miaoqinglang@huawei.com> --- arch/arm/mach-s3c64xx/setup-usb-phy.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)