From: Haneen Mohammed Date: Fri, 6 Mar 2015 17:01:07 +0000 (+0300) Subject: Staging: media: Replace dev_err with pr_err to avoid null pointer derefrence X-Git-Url: http://git.lede-project.org./?a=commitdiff_plain;h=14f63eeecfa3ca092f1c83755303161e53a9c641;p=openwrt%2Fstaging%2Fblogic.git Staging: media: Replace dev_err with pr_err to avoid null pointer derefrence This patch replace dev_err with pr_err, for pointer is derefrenced after comparing it to NULL. This was found using the following coccinelle script: @disable is_null@ identifier f; expression E; identifier fld; statement S; @@ + if(E == NULL) S f(...,E->fld,...); -if(E == NULL) S; @@ identifier f; expression E; identifier fld; statement S; @@ + if(!E) S f(...,E->fld,...); -if(!E) S; Signed-off-by: Haneen Mohammed Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/staging/media/lirc/lirc_zilog.c b/drivers/staging/media/lirc/lirc_zilog.c index e16627ca488e..261e27d6b054 100644 --- a/drivers/staging/media/lirc/lirc_zilog.c +++ b/drivers/staging/media/lirc/lirc_zilog.c @@ -1341,8 +1341,7 @@ static int close(struct inode *node, struct file *filep) struct IR *ir = filep->private_data; if (ir == NULL) { - dev_err(ir->l.dev, - "close: no private_data attached to the file!\n"); + pr_err("ir: close: no private_data attached to the file!\n"); return -ENODEV; }