diff mbox

ARM: OMAP2+: smsc911x: fix return value check in gpmc_smsc911x_init()

Message ID CAPgLHd9V0=GHGYgfuL7cCkzmZT7HVzuNg0iwwsOcipbnJ90bVw@mail.gmail.com (mailing list archive)
State New, archived
Headers show

Commit Message

Wei Yongjun Oct. 25, 2013, 9:31 a.m. UTC
From: Wei Yongjun <yongjun_wei@trendmicro.com.cn>

In case of error, the function platform_device_register_resndata()
returns ERR_PTR() and never returns NULL. The NULL test in the return
value check should be replaced with IS_ERR().

Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
---
 arch/arm/mach-omap2/gpmc-smsc911x.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Igor Grinberg Nov. 3, 2013, 9:50 a.m. UTC | #1
On 10/25/13 11:31, Wei Yongjun wrote:
> From: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
> 
> In case of error, the function platform_device_register_resndata()
> returns ERR_PTR() and never returns NULL. The NULL test in the return
> value check should be replaced with IS_ERR().
> 
> Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn>

Acked-by: Igor Grinberg <grinberg@compulab.co.il>

> ---
>  arch/arm/mach-omap2/gpmc-smsc911x.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/arch/arm/mach-omap2/gpmc-smsc911x.c b/arch/arm/mach-omap2/gpmc-smsc911x.c
> index ef99011..2757504 100644
> --- a/arch/arm/mach-omap2/gpmc-smsc911x.c
> +++ b/arch/arm/mach-omap2/gpmc-smsc911x.c
> @@ -83,7 +83,7 @@ void __init gpmc_smsc911x_init(struct omap_smsc911x_platform_data *gpmc_cfg)
>  	pdev = platform_device_register_resndata(NULL, "smsc911x", gpmc_cfg->id,
>  		 gpmc_smsc911x_resources, ARRAY_SIZE(gpmc_smsc911x_resources),
>  		 &gpmc_smsc911x_config, sizeof(gpmc_smsc911x_config));
> -	if (!pdev) {
> +	if (IS_ERR(pdev)) {
>  		pr_err("Unable to register platform device\n");
>  		gpio_free(gpmc_cfg->gpio_reset);
>  		goto free2;
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-omap" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>
Tony Lindgren Nov. 14, 2013, 6:41 p.m. UTC | #2
* Igor Grinberg <grinberg@compulab.co.il> [131103 01:50]:
> On 10/25/13 11:31, Wei Yongjun wrote:
> > From: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
> > 
> > In case of error, the function platform_device_register_resndata()
> > returns ERR_PTR() and never returns NULL. The NULL test in the return
> > value check should be replaced with IS_ERR().
> > 
> > Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
> 
> Acked-by: Igor Grinberg <grinberg@compulab.co.il>

Thanks applying into omap-for-v3.13/fixes.

Tony
 
> > ---
> >  arch/arm/mach-omap2/gpmc-smsc911x.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/arch/arm/mach-omap2/gpmc-smsc911x.c b/arch/arm/mach-omap2/gpmc-smsc911x.c
> > index ef99011..2757504 100644
> > --- a/arch/arm/mach-omap2/gpmc-smsc911x.c
> > +++ b/arch/arm/mach-omap2/gpmc-smsc911x.c
> > @@ -83,7 +83,7 @@ void __init gpmc_smsc911x_init(struct omap_smsc911x_platform_data *gpmc_cfg)
> >  	pdev = platform_device_register_resndata(NULL, "smsc911x", gpmc_cfg->id,
> >  		 gpmc_smsc911x_resources, ARRAY_SIZE(gpmc_smsc911x_resources),
> >  		 &gpmc_smsc911x_config, sizeof(gpmc_smsc911x_config));
> > -	if (!pdev) {
> > +	if (IS_ERR(pdev)) {
> >  		pr_err("Unable to register platform device\n");
> >  		gpio_free(gpmc_cfg->gpio_reset);
> >  		goto free2;
> > 
> > --
> > To unsubscribe from this list: send the line "unsubscribe linux-omap" in
> > the body of a message to majordomo@vger.kernel.org
> > More majordomo info at  http://vger.kernel.org/majordomo-info.html
> > 
> 
> -- 
> Regards,
> Igor.
diff mbox

Patch

diff --git a/arch/arm/mach-omap2/gpmc-smsc911x.c b/arch/arm/mach-omap2/gpmc-smsc911x.c
index ef99011..2757504 100644
--- a/arch/arm/mach-omap2/gpmc-smsc911x.c
+++ b/arch/arm/mach-omap2/gpmc-smsc911x.c
@@ -83,7 +83,7 @@  void __init gpmc_smsc911x_init(struct omap_smsc911x_platform_data *gpmc_cfg)
 	pdev = platform_device_register_resndata(NULL, "smsc911x", gpmc_cfg->id,
 		 gpmc_smsc911x_resources, ARRAY_SIZE(gpmc_smsc911x_resources),
 		 &gpmc_smsc911x_config, sizeof(gpmc_smsc911x_config));
-	if (!pdev) {
+	if (IS_ERR(pdev)) {
 		pr_err("Unable to register platform device\n");
 		gpio_free(gpmc_cfg->gpio_reset);
 		goto free2;