Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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 <hamohammed.sa@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Haneen Mohammed and committed by
Greg Kroah-Hartman
14f63eee cd25503f

+1 -2
+1 -2
drivers/staging/media/lirc/lirc_zilog.c
··· 1341 1341 struct IR *ir = filep->private_data; 1342 1342 1343 1343 if (ir == NULL) { 1344 - dev_err(ir->l.dev, 1345 - "close: no private_data attached to the file!\n"); 1344 + pr_err("ir: close: no private_data attached to the file!\n"); 1346 1345 return -ENODEV; 1347 1346 } 1348 1347