Re: [PATCH] usb: musb: Check for NULL pointers when no OTG transceiver used

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

 



Felipe Balbi wrote:
On Mon, Jun 29, 2009 at 09:25:49AM +0200, Quadros Roger (EXT-Teleca/Helsinki) wrote:
Felipe Balbi wrote:
Hi,

On Mon, Jun 29, 2009 at 09:04:36AM +0200, Quadros Roger (EXT-Teleca/Helsinki) wrote:
Even if we force transceiver selection in Kconfig, it is possible that the board files do not declare the OTG transceiver (e.g. the current rx51 board files) and hence otg_set_transceiver() is never called. This will lead to a kernel crash at musb_free() and musb_platform_exit(). IMHO we should check for NULL pointers anyway.

I will resend the patch with formatting fixes.
That's a problem of who wrote the board-file. The driver must expect
this pointer to be valid. That way we can easily find problems with
board-files missing transceiver initialization.

Yes it may be the problem with the board-file or board writer may temporarily not want to declare OTG due to some reason. Since the crash happens before console is initialized, we really can't see the cause of the error.
Wouldn't it be better to print an error message than to let the kernel lock up?

Then people wouldn't care about the error message. Maybe WARN() if that
pointer is null and otg is enabled.


Yes WARN should be appropriate. Below are the changes that i think of

-We can WARN just after calling usb_platform_init() if CONFIG_USB_MUSB_OTG is set and musb->xceiv is NULL.

-For omap2430.c, the NULL check for musb->xceiv must be moved from musb_platform_exit() to musb_platform_suspend() so that the OMAP OTG module is put to standby and clocks are disabled.
--
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