Re: [PATCH] drivers: video: i740fb: add 'default' processing contents for 'switch'.
From: Tomi Valkeinen <hidden>
Date: 2013-08-30 08:36:18
Attachments
- signature.asc [application/pgp-signature] 901 bytes
From: Tomi Valkeinen <hidden>
Date: 2013-08-30 08:36:18
On 30/08/13 11:17, Chen Gang wrote:
On 08/30/2013 03:21 PM, Tomi Valkeinen wrote:
quoted
I don't think you should use BUG there. BUG should be used when there's not really a good way to continue. Here you could have just a WARN, and return some default FIFO watermark value.i740_calc_fifo() is a static function, so we can check its caller's information to find the suitable fixing ways (for extern function, we almost can not do like this). it has only one caller i740fb_decode_var(), which has already let 'bpp' within the values (8, 15, 16, 24, 32). So if another values occurs, it must be a BUG (e.g. the stack may override under ia32).
My point was that there should almost never be need for BUG in a normal driver. BUG means that the whole kernel will probably halt. Even if an fb driver encounters a problem that should never happen, it should maybe give a WARN, and continue or fail in a controlled manner. Tomi