[dpdk-dev] [PATCH v1 03/28] eal/linux: extract function rte_eal_unbind_kernel_driver

Jianbo Liu jianbo.liu at linaro.org
Wed May 18 15:45:15 CEST 2016


On 18 May 2016 at 02:14, Jan Viktorin <viktorin at rehivetech.com> wrote:
> On Fri, 13 May 2016 09:22:23 +0800
> Jianbo Liu <jianbo.liu at linaro.org> wrote:
>
>> On 6 May 2016 at 21:47, Jan Viktorin <viktorin at rehivetech.com> wrote:
>> > Generalize the PCI-specific pci_unbind_kernel_driver. It is now divided into
>> > two parts. First, determination of the path and string identification of the
>> > device to be unbound. Second, the actual unbind operation which is generic.
>> > -       if ((n < 0) || (n >= (int)sizeof(buf))) {
>> > +       if ((n < 0) || (n >= (int)sizeof(devid))) {
>>
>> Is it better to move "(n >= (int)sizeof(devid))" before snprintf and
>> it has different reason from "n < 0"?
>
> I don't understant this comment. I cannot move the check for _n_ before
> the snprintf as it is its return value... Can you provide an example of
> your idea?
>
> Do you mean to split the condition to if (n < 0) and else if (n >= ...)?
>
No, I thought the correct output of devid is a fixed-size string, and
need to check the buf length before snprintf.
but it seems unnessaray. Sorry :(


More information about the dev mailing list