diff mbox

[-next] IB/hns: Fix return value check in hns_roce_get_cfg()

Message ID 1470445284-28970-1-git-send-email-weiyj.lk@gmail.com (mailing list archive)
State Accepted
Headers show

Commit Message

Wei Yongjun Aug. 6, 2016, 1:01 a.m. UTC
In case of error, the function devm_ioremap_resource() returns ERR_PTR()
and never returns NULL. The NULL test in the return value check should
be replaced with IS_ERR().

Signed-off-by: Wei Yongjun <weiyj.lk@gmail.com>
---
 drivers/infiniband/hw/hns/hns_roce_main.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)




--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Comments

Leon Romanovsky Aug. 7, 2016, 5:31 a.m. UTC | #1
On Sat, Aug 06, 2016 at 01:01:24AM +0000, Wei Yongjun wrote:
> In case of error, the function devm_ioremap_resource() returns ERR_PTR()
> and never returns NULL. The NULL test in the return value check should
> be replaced with IS_ERR().
> 
> Signed-off-by: Wei Yongjun <weiyj.lk@gmail.com>

On which branch did you base your patch?
It would be helpful to us if you followed SubmittionPatches document,
section with Fixes description. In such case "git describe" will give
immediate answer on my first question.

Thanks
Wei Yongjun Aug. 7, 2016, 12:19 p.m. UTC | #2
On 08/07/2016 01:31 PM, Leon Romanovsky wrote:
> On Sat, Aug 06, 2016 at 01:01:24AM +0000, Wei Yongjun wrote:
>> In case of error, the function devm_ioremap_resource() returns ERR_PTR()
>> and never returns NULL. The NULL test in the return value check should
>> be replaced with IS_ERR().
>>
>> Signed-off-by: Wei Yongjun <weiyj.lk@gmail.com>
> On which branch did you base your patch?
> It would be helpful to us if you followed SubmittionPatches document,
> section with Fixes description. In such case "git describe" will give
> immediate answer on my first question.
>
This patch is based on the linux-next.git tree.
Fixes: 5e43122add63 ('IB/hns: Add driver files for hns RoCE driver')

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Leon Romanovsky Aug. 7, 2016, 1:14 p.m. UTC | #3
On Sun, Aug 07, 2016 at 08:19:39PM +0800, Wei Yongjun wrote:
> On 08/07/2016 01:31 PM, Leon Romanovsky wrote:
> > On Sat, Aug 06, 2016 at 01:01:24AM +0000, Wei Yongjun wrote:
> >> In case of error, the function devm_ioremap_resource() returns ERR_PTR()
> >> and never returns NULL. The NULL test in the return value check should
> >> be replaced with IS_ERR().
> >>
> >> Signed-off-by: Wei Yongjun <weiyj.lk@gmail.com>
> > On which branch did you base your patch?
> > It would be helpful to us if you followed SubmittionPatches document,
> > section with Fixes description. In such case "git describe" will give
> > immediate answer on my first question.
> >
> This patch is based on the linux-next.git tree.
> Fixes: 5e43122add63 ('IB/hns: Add driver files for hns RoCE driver')

This driver wasn't part of last pull request and it is worth to consult
with Doug Ledford on the plans for this driver (stay in ->next, resubmit
e.t.c).

Right now, there is no tree to apply this patch.

Thanks
>
Wei Hu (Xavier) Aug. 11, 2016, 10:43 a.m. UTC | #4
Hi,  Doug Ledford

   Can you give me a suggestion that what we should do? Thanks very much!

Regards
Wei Hu

On 2016/8/7 21:14, Leon Romanovsky wrote:
> On Sun, Aug 07, 2016 at 08:19:39PM +0800, Wei Yongjun wrote:
>> On 08/07/2016 01:31 PM, Leon Romanovsky wrote:
>>> On Sat, Aug 06, 2016 at 01:01:24AM +0000, Wei Yongjun wrote:
>>>> In case of error, the function devm_ioremap_resource() returns ERR_PTR()
>>>> and never returns NULL. The NULL test in the return value check should
>>>> be replaced with IS_ERR().
>>>>
>>>> Signed-off-by: Wei Yongjun <weiyj.lk@gmail.com>
>>> On which branch did you base your patch?
>>> It would be helpful to us if you followed SubmittionPatches document,
>>> section with Fixes description. In such case "git describe" will give
>>> immediate answer on my first question.
>>>
>> This patch is based on the linux-next.git tree.
>> Fixes: 5e43122add63 ('IB/hns: Add driver files for hns RoCE driver')
> This driver wasn't part of last pull request and it is worth to consult
> with Doug Ledford on the plans for this driver (stay in ->next, resubmit
> e.t.c).
>
> Right now, there is no tree to apply this patch.
>
> Thanks


--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Doug Ledford Aug. 22, 2016, 6:15 p.m. UTC | #5
On 8/11/2016 6:43 AM, Wei Hu (Xavier) wrote:
> Hi,  Doug Ledford
> 
>   Can you give me a suggestion that what we should do? Thanks very much!

I still have a branch for your driver, the hns-roce branch in my tree
(only available via my github repo for now).  Now that Dave Miller has
taken in the most recent patch to add the needed reset function to the
hns net driver, I rebased your branch in my tree on his net-next branch.
 I'll submit it in the next merge window.  I then applied this patch on
top of that branch.  So, future patches to your driver need to be
against my hns-roce branch in my github repo, at least until I merge it
into my official k.o/for-4.9 branch.

> Regards
> Wei Hu
> 
> On 2016/8/7 21:14, Leon Romanovsky wrote:
>> On Sun, Aug 07, 2016 at 08:19:39PM +0800, Wei Yongjun wrote:
>>> On 08/07/2016 01:31 PM, Leon Romanovsky wrote:
>>>> On Sat, Aug 06, 2016 at 01:01:24AM +0000, Wei Yongjun wrote:
>>>>> In case of error, the function devm_ioremap_resource() returns
>>>>> ERR_PTR()
>>>>> and never returns NULL. The NULL test in the return value check should
>>>>> be replaced with IS_ERR().
>>>>>
>>>>> Signed-off-by: Wei Yongjun <weiyj.lk@gmail.com>
>>>> On which branch did you base your patch?
>>>> It would be helpful to us if you followed SubmittionPatches document,
>>>> section with Fixes description. In such case "git describe" will give
>>>> immediate answer on my first question.
>>>>
>>> This patch is based on the linux-next.git tree.
>>> Fixes: 5e43122add63 ('IB/hns: Add driver files for hns RoCE driver')
>> This driver wasn't part of last pull request and it is worth to consult
>> with Doug Ledford on the plans for this driver (stay in ->next, resubmit
>> e.t.c).
>>
>> Right now, there is no tree to apply this patch.
>>
>> Thanks
> 
>
Wei Hu (Xavier) Aug. 23, 2016, 1:56 a.m. UTC | #6
On 2016/8/23 2:15, Doug Ledford wrote:
> On 8/11/2016 6:43 AM, Wei Hu (Xavier) wrote:
>> Hi,  Doug Ledford
>>
>>    Can you give me a suggestion that what we should do? Thanks very much!
> I still have a branch for your driver, the hns-roce branch in my tree
> (only available via my github repo for now).  Now that Dave Miller has
> taken in the most recent patch to add the needed reset function to the
> hns net driver, I rebased your branch in my tree on his net-next branch.
>   I'll submit it in the next merge window.  I then applied this patch on
> top of that branch.  So, future patches to your driver need to be
> against my hns-roce branch in my github repo, at least until I merge it
> into my official k.o/for-4.9 branch.
Hi, Doug Ledford
     Can you provide us your hns-roce branch in github repo?
     Many thanks
Wei Hu
>> Regards
>> Wei Hu
>>
>> On 2016/8/7 21:14, Leon Romanovsky wrote:
>>> On Sun, Aug 07, 2016 at 08:19:39PM +0800, Wei Yongjun wrote:
>>>> On 08/07/2016 01:31 PM, Leon Romanovsky wrote:
>>>>> On Sat, Aug 06, 2016 at 01:01:24AM +0000, Wei Yongjun wrote:
>>>>>> In case of error, the function devm_ioremap_resource() returns
>>>>>> ERR_PTR()
>>>>>> and never returns NULL. The NULL test in the return value check should
>>>>>> be replaced with IS_ERR().
>>>>>>
>>>>>> Signed-off-by: Wei Yongjun <weiyj.lk@gmail.com>
>>>>> On which branch did you base your patch?
>>>>> It would be helpful to us if you followed SubmittionPatches document,
>>>>> section with Fixes description. In such case "git describe" will give
>>>>> immediate answer on my first question.
>>>>>
>>>> This patch is based on the linux-next.git tree.
>>>> Fixes: 5e43122add63 ('IB/hns: Add driver files for hns RoCE driver')
>>> This driver wasn't part of last pull request and it is worth to consult
>>> with Doug Ledford on the plans for this driver (stay in ->next, resubmit
>>> e.t.c).
>>>
>>> Right now, there is no tree to apply this patch.
>>>
>>> Thanks
>>
>


--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Leon Romanovsky Aug. 23, 2016, 10:59 a.m. UTC | #7
On Tue, Aug 23, 2016 at 09:56:53AM +0800, Wei Hu (Xavier) wrote:
> 
> 
> On 2016/8/23 2:15, Doug Ledford wrote:
> >On 8/11/2016 6:43 AM, Wei Hu (Xavier) wrote:
> >>Hi,  Doug Ledford
> >>
> >>   Can you give me a suggestion that what we should do? Thanks very much!
> >I still have a branch for your driver, the hns-roce branch in my tree
> >(only available via my github repo for now).  Now that Dave Miller has
> >taken in the most recent patch to add the needed reset function to the
> >hns net driver, I rebased your branch in my tree on his net-next branch.
> >  I'll submit it in the next merge window.  I then applied this patch on
> >top of that branch.  So, future patches to your driver need to be
> >against my hns-roce branch in my github repo, at least until I merge it
> >into my official k.o/for-4.9 branch.
> Hi, Doug Ledford
>     Can you provide us your hns-roce branch in github repo?

https://github.com/dledford/linux/tree/hns-roce
Wei Hu (Xavier) Aug. 24, 2016, 1:22 a.m. UTC | #8
On 2016/8/23 18:59, Leon Romanovsky wrote:
> On Tue, Aug 23, 2016 at 09:56:53AM +0800, Wei Hu (Xavier) wrote:
>>
>> On 2016/8/23 2:15, Doug Ledford wrote:
>>> On 8/11/2016 6:43 AM, Wei Hu (Xavier) wrote:
>>>> Hi,  Doug Ledford
>>>>
>>>>    Can you give me a suggestion that what we should do? Thanks very much!
>>> I still have a branch for your driver, the hns-roce branch in my tree
>>> (only available via my github repo for now).  Now that Dave Miller has
>>> taken in the most recent patch to add the needed reset function to the
>>> hns net driver, I rebased your branch in my tree on his net-next branch.
>>>   I'll submit it in the next merge window.  I then applied this patch on
>>> top of that branch.  So, future patches to your driver need to be
>>> against my hns-roce branch in my github repo, at least until I merge it
>>> into my official k.o/for-4.9 branch.
>> Hi, Doug Ledford
>>      Can you provide us your hns-roce branch in github repo?
> https://github.com/dledford/linux/tree/hns-roce
Thank you very much! :-)


--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/drivers/infiniband/hw/hns/hns_roce_main.c b/drivers/infiniband/hw/hns/hns_roce_main.c
index 5b42ec8..6ead671 100644
--- a/drivers/infiniband/hw/hns/hns_roce_main.c
+++ b/drivers/infiniband/hw/hns/hns_roce_main.c
@@ -715,8 +715,8 @@  static int hns_roce_get_cfg(struct hns_roce_dev *hr_dev)
 
 	res = platform_get_resource(hr_dev->pdev, IORESOURCE_MEM, 0);
 	hr_dev->reg_base = devm_ioremap_resource(dev, res);
-	if (!hr_dev->reg_base)
-		return -ENOMEM;
+	if (IS_ERR(hr_dev->reg_base))
+		return PTR_ERR(hr_dev->reg_base);
 
 	for (i = 0; i < HNS_ROCE_MAX_PORTS; i++) {
 		net_node = of_parse_phandle(np, "eth-handle", i);