> +    kpage = kmalloc(PAGE_SIZE, GFP_KERNEL);
 > +    if (kpage == 0) {
 > +            EDEB_ERR(4, "kpage alloc failed");
 > +            retcode = -ENOMEM;
 > +            goto ehca_reg_mr_rpages_exit0;
 > +    }
 > +    memset(kpage, 0, PAGE_SIZE);

kzalloc() -- or get_zeroed_page() might be even better.

also, don't test (kpage == 0); sparse will complain, and (!kpage) is
more idiomatic in the kernel.

 > +            if (i == ((pginfo->num_pages + 512 - 1) / 512) - 1) {
 > +                    rnum = pginfo->num_pages % 512; /* last shot */
 > +                    if (rnum == 0)
 > +                            rnum = 512;      /* last shot is full */
 > +            } else
 > +                    rnum = 512;

This code seems to be assuming PAGE_SIZE == 4096.  So maybe that
allocation should be of a 4K buffer rather than a PAGE_SIZE buffer.

 > +       ehca_reg_mr_rpages_exit1:
 > +    kfree(kpage);
 > +       ehca_reg_mr_rpages_exit0:

The indentation looks messed up here.  Labels should be indented one
tab less than the code.

 - R.
_______________________________________________
openib-general mailing list
[email protected]
http://openib.org/mailman/listinfo/openib-general

To unsubscribe, please visit http://openib.org/mailman/listinfo/openib-general

Reply via email to