Linux内核源代码review Case

来源:互联网 发布:java 获取磁盘io 编辑:程序博客网 时间:2024/05/22 15:29

本文原创为freas_1990,转载请标明出处:http://blog.csdn.net/freas_1990/article/details/18804425

Srikanth Thokala 在2014年1月22日为Xilinx AXI Video Direct Memory Access Engine提交了一个patch,该patch提供了双维度、独立、异步的读写通道,大幅度提升了读写的带宽。

Levente Kurusa 当天为代码做了批注,我们借他的批注来学习一下。 

> +       if (!err) {> +               u32 width = value >> 3; /* Convert bits to bytes */> +> +               /* If data width is greater than 8 bytes, DRE is not in hw */> +               if (width > 8)> +                       has_dre = false;> +> +               if (!has_dre)> +                       xdev->common.copy_align = fls(width - 1);> +       } else {> +               dev_err(xdev->dev, "missing xlnx,datawidth property\n");> +               return err;> +       }Can you please convert this to:if (err) { dev_err(...); return err;}That way we can avoid the else clause.
0 0
原创粉丝点击