lkml.org 
[lkml]   [2017]   [Apr]   [12]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] switchtec: Fix an error handling
On Tue, Apr 11, 2017 at 06:32:04AM +0200, Christophe JAILLET wrote:
> 'stuser_create' returns an error pointer in case of error, not NULL.
> So test its return value with IS_ERR.
>
> Fixes: 74004262f329 ("MicroSemi Switchtec management interface driver")
>
> Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>

Since this hasn't been merged to Linus' tree yet, I folded the fix
into the original commit on pci/switchtec and added attribution to
Christophe.

> ---
> drivers/pci/switch/switchtec.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> 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;
> --
> 2.11.0
>

\
 
 \ /
  Last update: 2017-04-12 19:28    [W:0.048 / U:16.348 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site