Re: [PATCH v1] chipidea: issue message when some calls fail in ->probe()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, 2014-11-14 at 15:58 +0800, Peter Chen wrote:
> On Thu, Nov 13, 2014 at 05:59:47PM +0200, Andy Shevchenko wrote:
> > There is no message when PHY is not enabled, IRQ line can't be acquired, or
> > debugfs registration fails. This patch adds the messages.
> > 
> 
> But you get the error return value from probe, it indicates the probe has
> failed, usually, we don't add more error information at probe.

I spend more than hour to understand what is happening in my case. I
compiled in the module and didn't get why probe failed.

With this patch applied I would have understood this like in couple of
minutes.

I think it is very useful to save time of debugging.

> 
> Peter
> > Signed-off-by: Andy Shevchenko <andriy.shevchenko@xxxxxxxxxxxxxxx>
> > ---
> >  drivers/usb/chipidea/core.c | 16 ++++++++++++----
> >  1 file changed, 12 insertions(+), 4 deletions(-)
> > 
> > diff --git a/drivers/usb/chipidea/core.c b/drivers/usb/chipidea/core.c
> > index c57448a..ffd2457 100644
> > --- a/drivers/usb/chipidea/core.c
> > +++ b/drivers/usb/chipidea/core.c
> > @@ -659,8 +659,10 @@ static int ci_hdrc_probe(struct platform_device *pdev)
> >  
> >  		/* if both generic PHY and USB PHY layers aren't enabled */
> >  		if (PTR_ERR(ci->phy) == -ENOSYS &&
> > -				PTR_ERR(ci->usb_phy) == -ENXIO)
> > +				PTR_ERR(ci->usb_phy) == -ENXIO) {
> > +			dev_err(dev, "PHY and USB PHY layers aren't enabled\n");
> >  			return -ENXIO;
> > +		}
> >  
> >  		if (IS_ERR(ci->phy) && IS_ERR(ci->usb_phy))
> >  			return -EPROBE_DEFER;
> > @@ -761,16 +763,22 @@ static int ci_hdrc_probe(struct platform_device *pdev)
> >  	platform_set_drvdata(pdev, ci);
> >  	ret = request_irq(ci->irq, ci_irq, IRQF_SHARED, ci->platdata->name,
> >  			  ci);
> > -	if (ret)
> > +	if (ret) {
> > +		dev_err(dev, "can't acquire IRQ line %d\n", ci->irq);
> >  		goto stop;
> > +	}
> >  
> >  	if (ci_otg_is_fsm_mode(ci))
> >  		ci_hdrc_otg_fsm_start(ci);
> >  
> >  	ret = dbg_create_files(ci);
> > -	if (!ret)
> > -		return 0;
> > +	if (ret) {
> > +		dev_err(dev, "can't register debugfs files\n");
> > +		goto release_irq;
> > +	}
> > +	return 0;
> >  
> > +release_irq:
> >  	free_irq(ci->irq, ci);
> >  stop:
> >  	ci_role_destroy(ci);
> > -- 
> > 2.1.3
> > 
> 


-- 
Andy Shevchenko <andriy.shevchenko@xxxxxxxxx>
Intel Finland Oy

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux