Skip to contentSkip to conversation

switchtec: checking for NULL instead of IS_ERR()

PATCH In review Dan Carpenter 2 participants 2 messages Apr 12, 2017

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 switchtec: checking for NULL instead of IS_ERR()

stuser_create() uses error pointers, it never returns NULL.

Fixes 74004262f329 ("MicroSemi Switchtec management interface driver")
drivers/pci/switch/switchtec.c +1 -1
index fcde98161d9a..cc6e085008fb 100644
@@ -608,7 +608,7 @@ static int switchtec_dev_open(struct inode *inode, struct file *filp)
 	stdev = container_of(inode->i_cdev, struct switchtec_dev, cdev);
 
 	stuser = stuser_create(stdev);
-	if (!stuser)
+	if (IS_ERR(stuser))
 		return PTR_ERR(stuser);
 
 	filp->private_data = stuser;
maintainer
#1 lore raw

Hi Dan,

Thanks for the fix. This is the exact same patch Christophe Jaillet sent a couple of days ago so only one needs to be merged.

Logan

Quoted 19 lines · Dan Carpenter

stuser_create() uses error pointers, it never returns NULL.

Fixes 74004262f329 ("MicroSemi Switchtec management interface driver")
drivers/pci/switch/switchtec.c +1 -1
index fcde98161d9a..cc6e085008fb 100644
@@ -608,7 +608,7 @@ static int switchtec_dev_open(struct inode *inode, struct file *filp)
 	stdev = container_of(inode->i_cdev, struct switchtec_dev, cdev);
 
 	stuser = stuser_create(stdev);
-	if (!stuser)
+	if (IS_ERR(stuser))
 		return PTR_ERR(stuser);
 
 	filp->private_data = stuser;