lkml.org 
[lkml]   [2017]   [Oct]   [12]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH] agp: fix clang warning on unread variable num_segments
Date
From: Colin Ian King <colin.king@canonical.com>

Currently variable num_segments is being assigned but never actually
used. Fix this actually using it in the for-loop. Also clean up the
code a little by assigning num_segments at declaration time.

Cleans up clang warning: Value stored to 'num_segments' is never read

Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
drivers/char/agp/frontend.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/char/agp/frontend.c b/drivers/char/agp/frontend.c
index f6955888e676..6476beba43b0 100644
--- a/drivers/char/agp/frontend.c
+++ b/drivers/char/agp/frontend.c
@@ -102,16 +102,15 @@ agp_segment_priv *agp_find_seg_in_client(const struct agp_client *client,
int size, pgprot_t page_prot)
{
struct agp_segment_priv *seg;
- int num_segments, i;
+ int i, num_segments = client->num_segments;
off_t pg_start;
size_t pg_count;

pg_start = offset / 4096;
pg_count = size / 4096;
seg = *(client->segments);
- num_segments = client->num_segments;

- for (i = 0; i < client->num_segments; i++) {
+ for (i = 0; i < num_segments; i++) {
if ((seg[i].pg_start == pg_start) &&
(seg[i].pg_count == pg_count) &&
(pgprot_val(seg[i].prot) == pgprot_val(page_prot))) {
--
2.14.1
\
 
 \ /
  Last update: 2017-10-12 17:48    [W:0.026 / U:0.984 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site