Re: [PATCH] kernel/range.c: subtract_range: return instead of continue to save some loops
On Mon, Mar 18, 2013 at 3:21 AM, Lin Feng wrote: > If we fall into that branch it means that there is a range fully covering the > subtract range, so it's suffice to return there if there isn't any other > overlapping ranges. > > Also fix the broken phrase issued by printk. > > Cc: Yinghai Lu > Signed-off-by: Lin Feng > --- > kernel/range.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/kernel/range.c b/kernel/range.c > index 9b8ae2d..223c6fe 100644 > --- a/kernel/range.c > +++ b/kernel/range.c > @@ -97,10 +97,10 @@ void subtract_range(struct range *range, int az, u64 > start, u64 end) > range[i].end = range[j].end; > range[i].start = end; > } else { > - printk(KERN_ERR "run of slot in ranges\n"); > + printk(KERN_ERR "run out of slot in > ranges\n"); maybe could change to pr_err at the same time. > } > range[j].end = start; > - continue; > + return; We don't say that ranges can not be overlapped in the array. Thanks Yinghai -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] kernel/range.c: subtract_range: return instead of continue to save some loops
If we fall into that branch it means that there is a range fully covering the subtract range, so it's suffice to return there if there isn't any other overlapping ranges. Also fix the broken phrase issued by printk. Cc: Yinghai Lu Signed-off-by: Lin Feng --- kernel/range.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/kernel/range.c b/kernel/range.c index 9b8ae2d..223c6fe 100644 --- a/kernel/range.c +++ b/kernel/range.c @@ -97,10 +97,10 @@ void subtract_range(struct range *range, int az, u64 start, u64 end) range[i].end = range[j].end; range[i].start = end; } else { - printk(KERN_ERR "run of slot in ranges\n"); + printk(KERN_ERR "run out of slot in ranges\n"); } range[j].end = start; - continue; + return; } } } -- 1.8.0.1 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] kernel/range.c: subtract_range: return instead of continue to save some loops
If we fall into that branch it means that there is a range fully covering the subtract range, so it's suffice to return there if there isn't any other overlapping ranges. Also fix the broken phrase issued by printk. Cc: Yinghai Lu ying...@kernel.org Signed-off-by: Lin Feng linf...@cn.fujitsu.com --- kernel/range.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/kernel/range.c b/kernel/range.c index 9b8ae2d..223c6fe 100644 --- a/kernel/range.c +++ b/kernel/range.c @@ -97,10 +97,10 @@ void subtract_range(struct range *range, int az, u64 start, u64 end) range[i].end = range[j].end; range[i].start = end; } else { - printk(KERN_ERR run of slot in ranges\n); + printk(KERN_ERR run out of slot in ranges\n); } range[j].end = start; - continue; + return; } } } -- 1.8.0.1 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH] kernel/range.c: subtract_range: return instead of continue to save some loops
On Mon, Mar 18, 2013 at 3:21 AM, Lin Feng linf...@cn.fujitsu.com wrote: If we fall into that branch it means that there is a range fully covering the subtract range, so it's suffice to return there if there isn't any other overlapping ranges. Also fix the broken phrase issued by printk. Cc: Yinghai Lu ying...@kernel.org Signed-off-by: Lin Feng linf...@cn.fujitsu.com --- kernel/range.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/kernel/range.c b/kernel/range.c index 9b8ae2d..223c6fe 100644 --- a/kernel/range.c +++ b/kernel/range.c @@ -97,10 +97,10 @@ void subtract_range(struct range *range, int az, u64 start, u64 end) range[i].end = range[j].end; range[i].start = end; } else { - printk(KERN_ERR run of slot in ranges\n); + printk(KERN_ERR run out of slot in ranges\n); maybe could change to pr_err at the same time. } range[j].end = start; - continue; + return; We don't say that ranges can not be overlapped in the array. Thanks Yinghai -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/