Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1620889 > unrolled thread
| Started by | Christophe JAILLET <christophe.jaillet@wanadoo.fr> |
|---|---|
| First post | 2017-04-11 06:40 +0200 |
| Last post | 2017-04-12 19:30 +0200 |
| Articles | 4 — 3 participants |
Back to article view | Back to linux.kernel
[PATCH] switchtec: Fix an error handling Christophe JAILLET <christophe.jaillet@wanadoo.fr> - 2017-04-11 06:40 +0200
Re: [PATCH] switchtec: Fix an error handling Logan Gunthorpe <logang@deltatee.com> - 2017-04-11 06:40 +0200
Re: [PATCH] switchtec: Fix an error handling Bjorn Helgaas <helgaas@kernel.org> - 2017-04-12 19:30 +0200
Re: [PATCH] switchtec: Fix an error handling Logan Gunthorpe <logang@deltatee.com> - 2017-04-12 19:30 +0200
| From | Christophe JAILLET <christophe.jaillet@wanadoo.fr> |
|---|---|
| Date | 2017-04-11 06:40 +0200 |
| Subject | [PATCH] switchtec: Fix an error handling |
| Message-ID | <tuVKV-2cx-1@gated-at.bofh.it> |
'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>
---
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
[toc] | [next] | [standalone]
| From | Logan Gunthorpe <logang@deltatee.com> |
|---|---|
| Date | 2017-04-11 06:40 +0200 |
| Message-ID | <tuVKW-2cx-7@gated-at.bofh.it> |
| In reply to | #1620889 |
Nice catch. Thanks.
Reviewed-by: Logan Gunthorpe <logang@deltatee.com>
Logan
On 10/04/17 10:32 PM, 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>
> ---
> 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;
>
[toc] | [prev] | [next] | [standalone]
| From | Bjorn Helgaas <helgaas@kernel.org> |
|---|---|
| Date | 2017-04-12 19:30 +0200 |
| Message-ID | <tvufD-7kr-13@gated-at.bofh.it> |
| In reply to | #1620889 |
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
>
[toc] | [prev] | [next] | [standalone]
| From | Logan Gunthorpe <logang@deltatee.com> |
|---|---|
| Date | 2017-04-12 19:30 +0200 |
| Message-ID | <tvufD-7kr-17@gated-at.bofh.it> |
| In reply to | #1622397 |
On 12/04/17 11:27 AM, Bjorn Helgaas wrote:
> 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.
Thanks Bjorn.
Logan
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web