All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] switchtec: checking for NULL instead of IS_ERR()
@ 2017-04-12  8:35 ` Dan Carpenter
  0 siblings, 0 replies; 4+ messages in thread
From: Dan Carpenter @ 2017-04-12  8:35 UTC (permalink / raw)
  To: Kurt Schwemmer, Logan Gunthorpe
  Cc: Stephen Bates, Bjorn Helgaas, linux-pci, kernel-janitors

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

Fixes: 74004262f329 ("MicroSemi Switchtec management interface driver")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

diff --git a/drivers/pci/switch/switchtec.c b/drivers/pci/switch/switchtec.c
index fcde98161d9a..cc6e085008fb 100644
--- a/drivers/pci/switch/switchtec.c
+++ b/drivers/pci/switch/switchtec.c
@@ -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;

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH] switchtec: checking for NULL instead of IS_ERR()
@ 2017-04-12  8:35 ` Dan Carpenter
  0 siblings, 0 replies; 4+ messages in thread
From: Dan Carpenter @ 2017-04-12  8:35 UTC (permalink / raw)
  To: Kurt Schwemmer, Logan Gunthorpe
  Cc: Stephen Bates, Bjorn Helgaas, linux-pci, kernel-janitors

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

Fixes: 74004262f329 ("MicroSemi Switchtec management interface driver")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

diff --git a/drivers/pci/switch/switchtec.c b/drivers/pci/switch/switchtec.c
index fcde98161d9a..cc6e085008fb 100644
--- a/drivers/pci/switch/switchtec.c
+++ b/drivers/pci/switch/switchtec.c
@@ -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;

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] switchtec: checking for NULL instead of IS_ERR()
  2017-04-12  8:35 ` Dan Carpenter
@ 2017-04-12 16:47   ` Logan Gunthorpe
  -1 siblings, 0 replies; 4+ messages in thread
From: Logan Gunthorpe @ 2017-04-12 16:47 UTC (permalink / raw)
  To: Dan Carpenter, Kurt Schwemmer
  Cc: Stephen Bates, Bjorn Helgaas, linux-pci, kernel-janitors

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

On 12/04/17 02:35 AM, Dan Carpenter wrote:
> stuser_create() uses error pointers, it never returns NULL.
> 
> Fixes: 74004262f329 ("MicroSemi Switchtec management interface driver")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> 
> diff --git a/drivers/pci/switch/switchtec.c b/drivers/pci/switch/switchtec.c
> index fcde98161d9a..cc6e085008fb 100644
> --- a/drivers/pci/switch/switchtec.c
> +++ b/drivers/pci/switch/switchtec.c
> @@ -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;
> 

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] switchtec: checking for NULL instead of IS_ERR()
@ 2017-04-12 16:47   ` Logan Gunthorpe
  0 siblings, 0 replies; 4+ messages in thread
From: Logan Gunthorpe @ 2017-04-12 16:47 UTC (permalink / raw)
  To: Dan Carpenter, Kurt Schwemmer
  Cc: Stephen Bates, Bjorn Helgaas, linux-pci, kernel-janitors

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

On 12/04/17 02:35 AM, Dan Carpenter wrote:
> stuser_create() uses error pointers, it never returns NULL.
> 
> Fixes: 74004262f329 ("MicroSemi Switchtec management interface driver")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> 
> diff --git a/drivers/pci/switch/switchtec.c b/drivers/pci/switch/switchtec.c
> index fcde98161d9a..cc6e085008fb 100644
> --- a/drivers/pci/switch/switchtec.c
> +++ b/drivers/pci/switch/switchtec.c
> @@ -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;
> 

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2017-04-12 16:47 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-04-12  8:35 [PATCH] switchtec: checking for NULL instead of IS_ERR() Dan Carpenter
2017-04-12  8:35 ` Dan Carpenter
2017-04-12 16:47 ` Logan Gunthorpe
2017-04-12 16:47   ` Logan Gunthorpe

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.