Hi Andy, On 09/01/2016 06:17 AM, Andy Shevchenko wrote: > On Tue, 2016-08-30 at 11:18 -0700, Sathyanarayanan Kuppuswamy wrote: > >> IMO, Main problem here is, In some scenarios get_platform_data >> returns >> NULL on error case and in some cases it return NULL for no platform >> data >> case. > We have possibility of the following scenarios: > 1) fatal error (should return error code and fail booting) > 2) non-fatal error (prevents certain device to be enumerated, pdata = > NULL) > 3) no pdata for the device (not an error! pdata is optional to the > certain driver) > 4) pdata != NULL (fully armed device driver) > > According to above I doubt we will have many 1) cases. Otherwise pdata = > NULL is okay. I agree with 2,3 and 4 scenarios. But I am not sure about the first case. Since these are peripheral devices, any failure in them should not stop the device boot. Do you have any examples for this case ? Attached patch fixes the return value issues in get_platform_data code in device_libs directory. Please check and let me know your comments. > >> For example, in following function, returning NULL on gpio_base == -1 >> and when nr >= PCAL9555A_NUM is incorrect. I think in both these >> scenarios valid behavior is to stop the device creation process. > Yes, but do _not_ stop processing and booting! > >> Creating an i2c device without validi irq number or gpio number is >> incorrect. >> >> So after investigating it bit more, I think its more appropriate to >> fix >> these error cases in device_libs dir. Let me know your comments. > I doubt that is a proper fix. It might be part of the fix in sfi.c where > you somehow distinguish fatal errors from non-fatal. > > -- Sathyanarayanan Kuppuswamy Android kernel developer