On 15 March 2017 at 09:48, Tobin C. Harding <me@xxxxxxxx> wrote: > Various functions take as parameter an optional pointer. Pointer > should be guarded with non-NULL check before dereferencing. > > While fixing this bug it was found that the file contains multiple > functions doing variations on the same thing, sdio_readb(), > sdio_writeb(), sdio_readw(), sdio_writew() etc. Although the functions > have very similar logic the code is laid out in a variety of > ways. This makes it overly complicated to read. There is a already a > nice clean chunk of code, if we use this format for all instances then > we will have cleaned up the code, reduced the line count and lessened > the cognitive load required while reading. > > Patch 01 adds non-NULL check before dereference of pointer. > > Patch 02 cleans up the return code to be simple and uniform. > > Code has not been tested. sdio_io.c with patches applied has been > checked with checkpatch, Sparse, and Smatch. Each patch has been > applied and built on x86_64 and PowerPC > > Tobin C. Harding (2): > mmc: core: guard dereference of optional parameter > mmc: core: simplify return code > > drivers/mmc/core/sdio_io.c | 54 ++++++++++++++++++---------------------------- > 1 file changed, 21 insertions(+), 33 deletions(-) > > -- > 2.7.4 > Thanks, applied for next! Kind regards Uffe -- To unsubscribe from this list: send the line "unsubscribe linux-mmc" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html