From: Guenter Roeck Date: Tue, 11 May 2021 04:55:12 +0000 (-0700) Subject: mei: Drop unnecessary NULL check after container_of X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=ca263dd848a26d243dca113469e6cff31a131bb6;p=linux.git mei: Drop unnecessary NULL check after container_of The result of container_of() operations is never NULL unless the embedded element is the first element of the data structure, which is not the case here. The NULL check is therefore unnecessary and misleading. Remove it. This change was made automatically with the following Coccinelle script. @@ type t; identifier v; statement s; @@ <+... ( t v = container_of(...); | v = container_of(...); ) ... when != v - if (\( !v \| v == NULL \) ) s ...+> Acked-by: Tomas Winkler Signed-off-by: Guenter Roeck Link: https://lore.kernel.org/r/20210511045512.2376580-1-linux@roeck-us.net Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/misc/mei/main.c b/drivers/misc/mei/main.c index 28937b6e7e0ca..9001c45f6fc4c 100644 --- a/drivers/misc/mei/main.c +++ b/drivers/misc/mei/main.c @@ -50,8 +50,6 @@ static int mei_open(struct inode *inode, struct file *file) int err; dev = container_of(inode->i_cdev, struct mei_device, cdev); - if (!dev) - return -ENODEV; mutex_lock(&dev->device_lock);