Fix checkpatch warning and add result holder variable to reduce overhead since the macro is called on functions. Signed-off-by: Nguyen Phan Quang Minh <minhnpq16@xxxxxxxxx> --- Since SET_CHECKED has a return statement, I'm very tempted to straight up remove it and do the checking inline. But the macro is used a lot (~60 times), I think it might hurt the readability of the code. drivers/staging/pi433/pi433_if.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/drivers/staging/pi433/pi433_if.c b/drivers/staging/pi433/pi433_if.c index 3404cb9722c9..77ab2986b985 100644 --- a/drivers/staging/pi433/pi433_if.c +++ b/drivers/staging/pi433/pi433_if.c @@ -122,9 +122,12 @@ struct pi433_instance { /*-------------------------------------------------------------------------*/ /* macro for checked access of registers of radio module */ -#define SET_CHECKED(retval) \ - if (retval < 0) \ - return retval; +#define SET_CHECKED(func) \ + do { \ + int retval = func; \ + if (retval < 0) \ + return retval; \ + } while (0) /*-------------------------------------------------------------------------*/ -- 2.15.1 _______________________________________________ devel mailing list devel@xxxxxxxxxxxxxxxxxxxxxx http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel