linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] tools, power: correct precedence of operators in init_maxfreq_mode
@ 2012-12-20 19:11 Sasha Levin
  2012-12-20 19:11 ` [PATCH] kvm tools: remove unneeded checks in qcow code Sasha Levin
                   ` (29 more replies)
  0 siblings, 30 replies; 64+ messages in thread
From: Sasha Levin @ 2012-12-20 19:11 UTC (permalink / raw)
  To: Dominik Brodowski, Thomas Renninger, Sasha Levin, linux-kernel

With the current code, the condition in the if() doesn't make much sense due to
precedence of operators.

Signed-off-by: Sasha Levin <sasha.levin@oracle.com>
---
 tools/power/cpupower/utils/idle_monitor/mperf_monitor.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/power/cpupower/utils/idle_monitor/mperf_monitor.c b/tools/power/cpupower/utils/idle_monitor/mperf_monitor.c
index 5650ab5..90a8c4f 100644
--- a/tools/power/cpupower/utils/idle_monitor/mperf_monitor.c
+++ b/tools/power/cpupower/utils/idle_monitor/mperf_monitor.c
@@ -237,7 +237,7 @@ static int init_maxfreq_mode(void)
 	unsigned long long hwcr;
 	unsigned long min;
 
-	if (!cpupower_cpu_info.caps & CPUPOWER_CAP_INV_TSC)
+	if (!(cpupower_cpu_info.caps & CPUPOWER_CAP_INV_TSC))
 		goto use_sysfs;
 
 	if (cpupower_cpu_info.vendor == X86_VENDOR_AMD) {
-- 
1.8.0


^ permalink raw reply related	[flat|nested] 64+ messages in thread

* [PATCH] kvm tools: remove unneeded checks in qcow code
  2012-12-20 19:11 [PATCH] tools, power: correct precedence of operators in init_maxfreq_mode Sasha Levin
@ 2012-12-20 19:11 ` Sasha Levin
  2012-12-21 22:03   ` Jesper Juhl
  2012-12-20 19:11 ` [PATCH] kvm tools: remove unneeded check from disk code Sasha Levin
                   ` (28 subsequent siblings)
  29 siblings, 1 reply; 64+ messages in thread
From: Sasha Levin @ 2012-12-20 19:11 UTC (permalink / raw)
  To: Pekka Enberg, Sasha Levin, Asias He, kvm, linux-kernel; +Cc: Sasha Levin

We already know q!=NULL at that point, no need to retest.

Signed-off-by: Sasha Levin <sasha.levin@oracle.com>
---
 tools/kvm/disk/qcow.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/tools/kvm/disk/qcow.c b/tools/kvm/disk/qcow.c
index ee2992e..64a2550 100644
--- a/tools/kvm/disk/qcow.c
+++ b/tools/kvm/disk/qcow.c
@@ -1361,8 +1361,7 @@ free_header:
 	if (q->header)
 		free(q->header);
 free_qcow:
-	if (q)
-		free(q);
+	free(q);
 
 	return NULL;
 }
@@ -1492,8 +1491,7 @@ free_header:
 	if (q->header)
 		free(q->header);
 free_qcow:
-	if (q)
-		free(q);
+	free(q);
 
 	return NULL;
 }
-- 
1.8.0


^ permalink raw reply related	[flat|nested] 64+ messages in thread

* [PATCH] kvm tools: remove unneeded check from disk code
  2012-12-20 19:11 [PATCH] tools, power: correct precedence of operators in init_maxfreq_mode Sasha Levin
  2012-12-20 19:11 ` [PATCH] kvm tools: remove unneeded checks in qcow code Sasha Levin
@ 2012-12-20 19:11 ` Sasha Levin
  2012-12-20 19:11 ` [PATCH] kvm tools: correctly compare pointer with NULL instead of 0 Sasha Levin
                   ` (27 subsequent siblings)
  29 siblings, 0 replies; 64+ messages in thread
From: Sasha Levin @ 2012-12-20 19:11 UTC (permalink / raw)
  To: Pekka Enberg, Sasha Levin, Asias He, kvm, linux-kernel; +Cc: Sasha Levin

We already know 'disk' is non-null.

Signed-off-by: Sasha Levin <sasha.levin@oracle.com>
---
 tools/kvm/disk/core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/kvm/disk/core.c b/tools/kvm/disk/core.c
index dd59751..4e9bda0 100644
--- a/tools/kvm/disk/core.c
+++ b/tools/kvm/disk/core.c
@@ -105,7 +105,7 @@ struct disk_image *disk_image__new(int fd, u64 size,
 	}
 
 #ifdef CONFIG_HAS_AIO
-	if (disk) {
+	{
 		pthread_t thread;
 
 		disk->evt = eventfd(0, 0);
-- 
1.8.0


^ permalink raw reply related	[flat|nested] 64+ messages in thread

* [PATCH] kvm tools: correctly compare pointer with NULL instead of 0
  2012-12-20 19:11 [PATCH] tools, power: correct precedence of operators in init_maxfreq_mode Sasha Levin
  2012-12-20 19:11 ` [PATCH] kvm tools: remove unneeded checks in qcow code Sasha Levin
  2012-12-20 19:11 ` [PATCH] kvm tools: remove unneeded check from disk code Sasha Levin
@ 2012-12-20 19:11 ` Sasha Levin
  2012-12-20 19:11 ` [PATCH] tools lib traceevent: remove redundant check from process_dynamic_array Sasha Levin
                   ` (26 subsequent siblings)
  29 siblings, 0 replies; 64+ messages in thread
From: Sasha Levin @ 2012-12-20 19:11 UTC (permalink / raw)
  To: Pekka Enberg, Sasha Levin, Asias He, Cyrill Gorcunov,
	Will Deacon, kvm, linux-kernel
  Cc: Sasha Levin

Signed-off-by: Sasha Levin <sasha.levin@oracle.com>
---
 tools/kvm/hw/pci-shmem.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/kvm/hw/pci-shmem.c b/tools/kvm/hw/pci-shmem.c
index 00e5d93..ec3f771 100644
--- a/tools/kvm/hw/pci-shmem.c
+++ b/tools/kvm/hw/pci-shmem.c
@@ -356,7 +356,7 @@ int pci_shmem__init(struct kvm *kvm)
 	char *mem;
 	int r;
 
-	if (shmem_region == 0)
+	if (shmem_region == NULL)
 		return 0;
 
 	/* Register good old INTx */
-- 
1.8.0


^ permalink raw reply related	[flat|nested] 64+ messages in thread

* [PATCH] tools lib traceevent: remove redundant check from process_dynamic_array
  2012-12-20 19:11 [PATCH] tools, power: correct precedence of operators in init_maxfreq_mode Sasha Levin
                   ` (2 preceding siblings ...)
  2012-12-20 19:11 ` [PATCH] kvm tools: correctly compare pointer with NULL instead of 0 Sasha Levin
@ 2012-12-20 19:11 ` Sasha Levin
  2012-12-21 12:58   ` Namhyung Kim
  2012-12-20 19:11 ` [PATCH] epoll: stop comparing pointers with 0 in self-test app Sasha Levin
                   ` (25 subsequent siblings)
  29 siblings, 1 reply; 64+ messages in thread
From: Sasha Levin @ 2012-12-20 19:11 UTC (permalink / raw)
  To: Namhyung Kim, Steven Rostedt, Arnaldo Carvalho de Melo,
	Frederic Weisbecker, linux-kernel
  Cc: Sasha Levin

We check twice that 'field' is non-NULL, no need to do that.

Signed-off-by: Sasha Levin <sasha.levin@oracle.com>
---
 tools/lib/traceevent/event-parse.c | 5 -----
 1 file changed, 5 deletions(-)

diff --git a/tools/lib/traceevent/event-parse.c b/tools/lib/traceevent/event-parse.c
index 5a824e3..f7dc053 100644
--- a/tools/lib/traceevent/event-parse.c
+++ b/tools/lib/traceevent/event-parse.c
@@ -2481,11 +2481,6 @@ process_dynamic_array(struct event_format *event, struct print_arg *arg, char **
 
 	free_token(token);
 	arg = alloc_arg();
-	if (!field) {
-		do_warning("%s: not enough memory!", __func__);
-		*tok = NULL;
-		return EVENT_ERROR;
-	}
 
 	type = process_arg(event, arg, &token);
 	if (type == EVENT_ERROR)
-- 
1.8.0


^ permalink raw reply related	[flat|nested] 64+ messages in thread

* [PATCH] epoll: stop comparing pointers with 0 in self-test app
  2012-12-20 19:11 [PATCH] tools, power: correct precedence of operators in init_maxfreq_mode Sasha Levin
                   ` (3 preceding siblings ...)
  2012-12-20 19:11 ` [PATCH] tools lib traceevent: remove redundant check from process_dynamic_array Sasha Levin
@ 2012-12-20 19:11 ` Sasha Levin
  2012-12-21  2:55   ` Daniel Hazelton
  2012-12-20 19:11 ` [PATCH] tools/usb: remove unneeded 'continue' and simplify condition Sasha Levin
                   ` (24 subsequent siblings)
  29 siblings, 1 reply; 64+ messages in thread
From: Sasha Levin @ 2012-12-20 19:11 UTC (permalink / raw)
  To: Andrew Morton, Paton J. Lewis, Sasha Levin, Daniel Hazelton,
	linux-kernel

Signed-off-by: Sasha Levin <sasha.levin@oracle.com>
---
 tools/testing/selftests/epoll/test_epoll.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tools/testing/selftests/epoll/test_epoll.c b/tools/testing/selftests/epoll/test_epoll.c
index 4a14a7f..1034ed4 100644
--- a/tools/testing/selftests/epoll/test_epoll.c
+++ b/tools/testing/selftests/epoll/test_epoll.c
@@ -199,8 +199,8 @@ int main(int argc, char **argv)
 
 	epoll_items = malloc(n_epoll_items * sizeof(struct epoll_item_private));
 
-	if (epoll_set < 0 || epoll_items == 0 || write_thread_data.fds == 0 ||
-		read_thread_data == 0 || read_threads == 0)
+	if (epoll_set < 0 || !epoll_items || write_thread_data.fds == NULL ||
+		!read_thread_data || !read_threads)
 		goto error;
 
 	if (sysconf(_SC_NPROCESSORS_ONLN) < 2) {
-- 
1.8.0


^ permalink raw reply related	[flat|nested] 64+ messages in thread

* [PATCH] tools/usb: remove unneeded 'continue' and simplify condition
  2012-12-20 19:11 [PATCH] tools, power: correct precedence of operators in init_maxfreq_mode Sasha Levin
                   ` (4 preceding siblings ...)
  2012-12-20 19:11 ` [PATCH] epoll: stop comparing pointers with 0 in self-test app Sasha Levin
@ 2012-12-20 19:11 ` Sasha Levin
  2012-12-20 20:32   ` Felipe Balbi
  2012-12-20 19:11 ` [PATCH] perf kmem: use ARRAY_SIZE instead of reinventing it Sasha Levin
                   ` (23 subsequent siblings)
  29 siblings, 1 reply; 64+ messages in thread
From: Sasha Levin @ 2012-12-20 19:11 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Du Changbin, Michal Nazarewicz, Sasha Levin,
	Felipe Balbi, linux-kernel

Basically remove unneeded code. Since that 'continue' is at the end
of the for() there's no need for it.

Signed-off-by: Sasha Levin <sasha.levin@oracle.com>
---
 tools/usb/testusb.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/tools/usb/testusb.c b/tools/usb/testusb.c
index 68d0734..643cd77 100644
--- a/tools/usb/testusb.c
+++ b/tools/usb/testusb.c
@@ -507,10 +507,8 @@ usage:
 			return handle_testdev (entry) != entry;
 		}
 		status = pthread_create (&entry->thread, 0, handle_testdev, entry);
-		if (status) {
+		if (status)
 			perror ("pthread_create");
-			continue;
-		}
 	}
 	if (device) {
 		struct testdev		dev;
-- 
1.8.0


^ permalink raw reply related	[flat|nested] 64+ messages in thread

* [PATCH] perf kmem: use ARRAY_SIZE instead of reinventing it
  2012-12-20 19:11 [PATCH] tools, power: correct precedence of operators in init_maxfreq_mode Sasha Levin
                   ` (5 preceding siblings ...)
  2012-12-20 19:11 ` [PATCH] tools/usb: remove unneeded 'continue' and simplify condition Sasha Levin
@ 2012-12-20 19:11 ` Sasha Levin
  2013-01-25 11:19   ` [tip:perf/core] " tip-bot for Sasha Levin
  2012-12-20 19:11 ` [PATCH] cpupowerutils: don't compare pointers with 0 Sasha Levin
                   ` (22 subsequent siblings)
  29 siblings, 1 reply; 64+ messages in thread
From: Sasha Levin @ 2012-12-20 19:11 UTC (permalink / raw)
  To: Peter Zijlstra, Paul Mackerras, Ingo Molnar,
	Arnaldo Carvalho de Melo, linux-kernel
  Cc: Sasha Levin

Signed-off-by: Sasha Levin <sasha.levin@oracle.com>
---
 tools/perf/builtin-kmem.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/tools/perf/builtin-kmem.c b/tools/perf/builtin-kmem.c
index 0b4b796..266031f 100644
--- a/tools/perf/builtin-kmem.c
+++ b/tools/perf/builtin-kmem.c
@@ -614,8 +614,7 @@ static struct sort_dimension *avail_sorts[] = {
 	&pingpong_sort_dimension,
 };
 
-#define NUM_AVAIL_SORTS	\
-	(int)(sizeof(avail_sorts) / sizeof(struct sort_dimension *))
+#define NUM_AVAIL_SORTS	((int)ARRAY_SIZE(avail_sorts))
 
 static int sort_dimension__add(const char *tok, struct list_head *list)
 {
-- 
1.8.0


^ permalink raw reply related	[flat|nested] 64+ messages in thread

* [PATCH] cpupowerutils: don't compare pointers with 0
  2012-12-20 19:11 [PATCH] tools, power: correct precedence of operators in init_maxfreq_mode Sasha Levin
                   ` (6 preceding siblings ...)
  2012-12-20 19:11 ` [PATCH] perf kmem: use ARRAY_SIZE instead of reinventing it Sasha Levin
@ 2012-12-20 19:11 ` Sasha Levin
  2012-12-21 21:41   ` Thomas Renninger
  2012-12-20 19:11 ` [PATCH] m2m-deinterlace: use correct check for kzalloc failure Sasha Levin
                   ` (21 subsequent siblings)
  29 siblings, 1 reply; 64+ messages in thread
From: Sasha Levin @ 2012-12-20 19:11 UTC (permalink / raw)
  To: Dominik Brodowski, Thomas Renninger, Sasha Levin, linux-kernel

Signed-off-by: Sasha Levin <sasha.levin@oracle.com>
---
 tools/power/cpupower/utils/helpers/bitmask.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/tools/power/cpupower/utils/helpers/bitmask.c b/tools/power/cpupower/utils/helpers/bitmask.c
index 5c074c6..3b6e03d 100644
--- a/tools/power/cpupower/utils/helpers/bitmask.c
+++ b/tools/power/cpupower/utils/helpers/bitmask.c
@@ -25,11 +25,11 @@ struct bitmask *bitmask_alloc(unsigned int n)
 	struct bitmask *bmp;
 
 	bmp = malloc(sizeof(*bmp));
-	if (bmp == 0)
+	if (bmp == NULL)
 		return 0;
 	bmp->size = n;
 	bmp->maskp = calloc(longsperbits(n), sizeof(unsigned long));
-	if (bmp->maskp == 0) {
+	if (bmp->maskp == NULL) {
 		free(bmp);
 		return 0;
 	}
@@ -39,7 +39,7 @@ struct bitmask *bitmask_alloc(unsigned int n)
 /* Free `struct bitmask` */
 void bitmask_free(struct bitmask *bmp)
 {
-	if (bmp == 0)
+	if (bmp == NULL)
 		return;
 	free(bmp->maskp);
 	bmp->maskp = (unsigned long *)0xdeadcdef;  /* double free tripwire */
-- 
1.8.0


^ permalink raw reply related	[flat|nested] 64+ messages in thread

* [PATCH] m2m-deinterlace: use correct check for kzalloc failure
  2012-12-20 19:11 [PATCH] tools, power: correct precedence of operators in init_maxfreq_mode Sasha Levin
                   ` (7 preceding siblings ...)
  2012-12-20 19:11 ` [PATCH] cpupowerutils: don't compare pointers with 0 Sasha Levin
@ 2012-12-20 19:11 ` Sasha Levin
  2012-12-20 19:11 ` [PATCH] perf script: use ARRAY_SIZE instead of reinventing it Sasha Levin
                   ` (20 subsequent siblings)
  29 siblings, 0 replies; 64+ messages in thread
From: Sasha Levin @ 2012-12-20 19:11 UTC (permalink / raw)
  To: Mauro Carvalho Chehab, Sylwester Nawrocki, Javier Martin,
	Sasha Levin, Sakari Ailus, linux-media, linux-kernel

There is no point in PTR_ERR()ing a NULL pointer, use a real error
instead.

Signed-off-by: Sasha Levin <sasha.levin@oracle.com>
---
 drivers/media/platform/m2m-deinterlace.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/media/platform/m2m-deinterlace.c b/drivers/media/platform/m2m-deinterlace.c
index 05c560f..64db74e 100644
--- a/drivers/media/platform/m2m-deinterlace.c
+++ b/drivers/media/platform/m2m-deinterlace.c
@@ -917,10 +917,8 @@ static int deinterlace_open(struct file *file)
 	ctx->xt = kzalloc(sizeof(struct dma_async_tx_descriptor) +
 				sizeof(struct data_chunk), GFP_KERNEL);
 	if (!ctx->xt) {
-		int ret = PTR_ERR(ctx->xt);
-
 		kfree(ctx);
-		return ret;
+		return -ENOMEM;
 	}
 
 	ctx->colorspace = V4L2_COLORSPACE_REC709;
-- 
1.8.0


^ permalink raw reply related	[flat|nested] 64+ messages in thread

* [PATCH] perf script: use ARRAY_SIZE instead of reinventing it
  2012-12-20 19:11 [PATCH] tools, power: correct precedence of operators in init_maxfreq_mode Sasha Levin
                   ` (8 preceding siblings ...)
  2012-12-20 19:11 ` [PATCH] m2m-deinterlace: use correct check for kzalloc failure Sasha Levin
@ 2012-12-20 19:11 ` Sasha Levin
  2013-01-25 11:20   ` [tip:perf/core] " tip-bot for Sasha Levin
  2012-12-20 19:11 ` [PATCH] perf tools: remove redundant checks from _sort__sym_cmp Sasha Levin
                   ` (19 subsequent siblings)
  29 siblings, 1 reply; 64+ messages in thread
From: Sasha Levin @ 2012-12-20 19:11 UTC (permalink / raw)
  To: Peter Zijlstra, Paul Mackerras, Ingo Molnar,
	Arnaldo Carvalho de Melo, linux-kernel
  Cc: Sasha Levin

Signed-off-by: Sasha Levin <sasha.levin@oracle.com>
---
 tools/perf/builtin-script.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/perf/builtin-script.c b/tools/perf/builtin-script.c
index b363e7b..3314ef2 100644
--- a/tools/perf/builtin-script.c
+++ b/tools/perf/builtin-script.c
@@ -692,7 +692,7 @@ static int parse_output_fields(const struct option *opt __maybe_unused,
 			    const char *arg, int unset __maybe_unused)
 {
 	char *tok;
-	int i, imax = sizeof(all_output_options) / sizeof(struct output_option);
+	int i, imax = ARRAY_SIZE(all_output_options);
 	int j;
 	int rc = 0;
 	char *str = strdup(arg);
-- 
1.8.0


^ permalink raw reply related	[flat|nested] 64+ messages in thread

* [PATCH] perf tools: remove redundant checks from _sort__sym_cmp
  2012-12-20 19:11 [PATCH] tools, power: correct precedence of operators in init_maxfreq_mode Sasha Levin
                   ` (9 preceding siblings ...)
  2012-12-20 19:11 ` [PATCH] perf script: use ARRAY_SIZE instead of reinventing it Sasha Levin
@ 2012-12-20 19:11 ` Sasha Levin
  2012-12-21 12:55   ` Namhyung Kim
  2013-01-25 11:17   ` [tip:perf/core] " tip-bot for Sasha Levin
  2012-12-20 19:11 ` [PATCH] virtio_console: correct error message on failure of debugfs_create_dir Sasha Levin
                   ` (18 subsequent siblings)
  29 siblings, 2 replies; 64+ messages in thread
From: Sasha Levin @ 2012-12-20 19:11 UTC (permalink / raw)
  To: Peter Zijlstra, Paul Mackerras, Ingo Molnar,
	Arnaldo Carvalho de Melo, Namhyung Kim, Stephane Eranian,
	Sasha Levin, linux-kernel

We already check that sym_l and sum_r are non-NULLs, no need to
do it twice.

Signed-off-by: Sasha Levin <sasha.levin@oracle.com>
---
 tools/perf/util/sort.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/tools/perf/util/sort.c b/tools/perf/util/sort.c
index cfd1c0f..dbaded9 100644
--- a/tools/perf/util/sort.c
+++ b/tools/perf/util/sort.c
@@ -143,10 +143,8 @@ static int64_t _sort__sym_cmp(struct symbol *sym_l, struct symbol *sym_r,
 	if (sym_l == sym_r)
 		return 0;
 
-	if (sym_l)
-		ip_l = sym_l->start;
-	if (sym_r)
-		ip_r = sym_r->start;
+	ip_l = sym_l->start;
+	ip_r = sym_r->start;
 
 	return (int64_t)(ip_r - ip_l);
 }
-- 
1.8.0


^ permalink raw reply related	[flat|nested] 64+ messages in thread

* [PATCH] virtio_console: correct error message on failure of debugfs_create_dir
  2012-12-20 19:11 [PATCH] tools, power: correct precedence of operators in init_maxfreq_mode Sasha Levin
                   ` (10 preceding siblings ...)
  2012-12-20 19:11 ` [PATCH] perf tools: remove redundant checks from _sort__sym_cmp Sasha Levin
@ 2012-12-20 19:11 ` Sasha Levin
  2012-12-21  7:59   ` Amit Shah
  2012-12-20 19:11 ` [PATCH] debugfs: remove redundant initialization of dentry Sasha Levin
                   ` (17 subsequent siblings)
  29 siblings, 1 reply; 64+ messages in thread
From: Sasha Levin @ 2012-12-20 19:11 UTC (permalink / raw)
  To: Amit Shah, Arnd Bergmann, Greg Kroah-Hartman, virtualization,
	linux-kernel
  Cc: Sasha Levin

debugfs_create_dir() returns NULL if it fails, there's little point in
calling PTR_ERR on it.

Signed-off-by: Sasha Levin <sasha.levin@oracle.com>
---
 drivers/char/virtio_console.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/drivers/char/virtio_console.c b/drivers/char/virtio_console.c
index c594cb1..490b70e 100644
--- a/drivers/char/virtio_console.c
+++ b/drivers/char/virtio_console.c
@@ -2212,10 +2212,9 @@ static int __init init(void)
 	}
 
 	pdrvdata.debugfs_dir = debugfs_create_dir("virtio-ports", NULL);
-	if (!pdrvdata.debugfs_dir) {
-		pr_warning("Error %ld creating debugfs dir for virtio-ports\n",
-			   PTR_ERR(pdrvdata.debugfs_dir));
-	}
+	if (!pdrvdata.debugfs_dir)
+		pr_warn("Error creating debugfs dir for virtio-ports\n");
+
 	INIT_LIST_HEAD(&pdrvdata.consoles);
 	INIT_LIST_HEAD(&pdrvdata.portdevs);
 
-- 
1.8.0


^ permalink raw reply related	[flat|nested] 64+ messages in thread

* [PATCH] debugfs: remove redundant initialization of dentry
  2012-12-20 19:11 [PATCH] tools, power: correct precedence of operators in init_maxfreq_mode Sasha Levin
                   ` (11 preceding siblings ...)
  2012-12-20 19:11 ` [PATCH] virtio_console: correct error message on failure of debugfs_create_dir Sasha Levin
@ 2012-12-20 19:11 ` Sasha Levin
  2012-12-20 19:11 ` [PATCH] PCI: cpqphp: minor cleanup and removal of unreachable paths Sasha Levin
                   ` (16 subsequent siblings)
  29 siblings, 0 replies; 64+ messages in thread
From: Sasha Levin @ 2012-12-20 19:11 UTC (permalink / raw)
  To: Greg Kroah-Hartman, linux-kernel; +Cc: Sasha Levin

We already initialize it to NULL when declaring it, no need to do
that twice.

Signed-off-by: Sasha Levin <sasha.levin@oracle.com>
---
 fs/debugfs/inode.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/fs/debugfs/inode.c b/fs/debugfs/inode.c
index 153bb1e..d329f9c 100644
--- a/fs/debugfs/inode.c
+++ b/fs/debugfs/inode.c
@@ -322,7 +322,6 @@ static struct dentry *__create_file(const char *name, umode_t mode,
 	if (!parent)
 		parent = debugfs_mount->mnt_root;
 
-	dentry = NULL;
 	mutex_lock(&parent->d_inode->i_mutex);
 	dentry = lookup_one_len(name, parent, strlen(name));
 	if (!IS_ERR(dentry)) {
-- 
1.8.0


^ permalink raw reply related	[flat|nested] 64+ messages in thread

* [PATCH] PCI: cpqphp: minor cleanup and removal of unreachable paths
  2012-12-20 19:11 [PATCH] tools, power: correct precedence of operators in init_maxfreq_mode Sasha Levin
                   ` (12 preceding siblings ...)
  2012-12-20 19:11 ` [PATCH] debugfs: remove redundant initialization of dentry Sasha Levin
@ 2012-12-20 19:11 ` Sasha Levin
  2013-01-07 18:48   ` Bjorn Helgaas
  2012-12-20 19:11 ` [PATCH] bnx2x: use ARRAY_SIZE where possible Sasha Levin
                   ` (15 subsequent siblings)
  29 siblings, 1 reply; 64+ messages in thread
From: Sasha Levin @ 2012-12-20 19:11 UTC (permalink / raw)
  To: Bjorn Helgaas, Sasha Levin, Alan Cox, linux-pci, linux-kernel

Remove cases of redundant checks and remote unreachable paths.

Signed-off-by: Sasha Levin <sasha.levin@oracle.com>
---
 drivers/pci/hotplug/cpqphp_ctrl.c | 57 ++++++++++++++-------------------------
 1 file changed, 20 insertions(+), 37 deletions(-)

diff --git a/drivers/pci/hotplug/cpqphp_ctrl.c b/drivers/pci/hotplug/cpqphp_ctrl.c
index 36112fe..d282019 100644
--- a/drivers/pci/hotplug/cpqphp_ctrl.c
+++ b/drivers/pci/hotplug/cpqphp_ctrl.c
@@ -1900,8 +1900,7 @@ static void interrupt_event_handler(struct controller *ctrl)
 					dbg("power fault\n");
 				} else {
 					/* refresh notification */
-					if (p_slot)
-						update_slot_info(ctrl, p_slot);
+					update_slot_info(ctrl, p_slot);
 				}
 
 				ctrl->event_queue[loop].event_type = 0;
@@ -2520,44 +2519,28 @@ static int configure_new_function(struct controller *ctrl, struct pci_func *func
 
 		/* If we have IO resources copy them and fill in the bridge's
 		 * IO range registers */
-		if (io_node) {
-			memcpy(hold_IO_node, io_node, sizeof(struct pci_resource));
-			io_node->next = NULL;
+		memcpy(hold_IO_node, io_node, sizeof(struct pci_resource));
+		io_node->next = NULL;
 
-			/* set IO base and Limit registers */
-			temp_byte = io_node->base >> 8;
-			rc = pci_bus_write_config_byte(pci_bus, devfn, PCI_IO_BASE, temp_byte);
+		/* set IO base and Limit registers */
+		temp_byte = io_node->base >> 8;
+		rc = pci_bus_write_config_byte(pci_bus, devfn, PCI_IO_BASE, temp_byte);
 
-			temp_byte = (io_node->base + io_node->length - 1) >> 8;
-			rc = pci_bus_write_config_byte(pci_bus, devfn, PCI_IO_LIMIT, temp_byte);
-		} else {
-			kfree(hold_IO_node);
-			hold_IO_node = NULL;
-		}
-
-		/* If we have memory resources copy them and fill in the
-		 * bridge's memory range registers.  Otherwise, fill in the
-		 * range registers with values that disable them. */
-		if (mem_node) {
-			memcpy(hold_mem_node, mem_node, sizeof(struct pci_resource));
-			mem_node->next = NULL;
-
-			/* set Mem base and Limit registers */
-			temp_word = mem_node->base >> 16;
-			rc = pci_bus_write_config_word(pci_bus, devfn, PCI_MEMORY_BASE, temp_word);
+		temp_byte = (io_node->base + io_node->length - 1) >> 8;
+		rc = pci_bus_write_config_byte(pci_bus, devfn, PCI_IO_LIMIT, temp_byte);
 
-			temp_word = (mem_node->base + mem_node->length - 1) >> 16;
-			rc = pci_bus_write_config_word(pci_bus, devfn, PCI_MEMORY_LIMIT, temp_word);
-		} else {
-			temp_word = 0xFFFF;
-			rc = pci_bus_write_config_word(pci_bus, devfn, PCI_MEMORY_BASE, temp_word);
+		/* Copy the memory resources and fill in the bridge's memory
+		 * range registers.
+		 */
+		memcpy(hold_mem_node, mem_node, sizeof(struct pci_resource));
+		mem_node->next = NULL;
 
-			temp_word = 0x0000;
-			rc = pci_bus_write_config_word(pci_bus, devfn, PCI_MEMORY_LIMIT, temp_word);
+		/* set Mem base and Limit registers */
+		temp_word = mem_node->base >> 16;
+		rc = pci_bus_write_config_word(pci_bus, devfn, PCI_MEMORY_BASE, temp_word);
 
-			kfree(hold_mem_node);
-			hold_mem_node = NULL;
-		}
+		temp_word = (mem_node->base + mem_node->length - 1) >> 16;
+		rc = pci_bus_write_config_word(pci_bus, devfn, PCI_MEMORY_LIMIT, temp_word);
 
 		memcpy(hold_p_mem_node, p_mem_node, sizeof(struct pci_resource));
 		p_mem_node->next = NULL;
@@ -2627,7 +2610,7 @@ static int configure_new_function(struct controller *ctrl, struct pci_func *func
 		/* Return unused bus resources
 		 * First use the temporary node to store information for
 		 * the board */
-		if (hold_bus_node && bus_node && temp_resources.bus_head) {
+		if (bus_node && temp_resources.bus_head) {
 			hold_bus_node->length = bus_node->base - hold_bus_node->base;
 
 			hold_bus_node->next = func->bus_head;
@@ -2751,7 +2734,7 @@ static int configure_new_function(struct controller *ctrl, struct pci_func *func
 		}
 		/* If we have prefetchable memory space available and there
 		 * is some left at the end, return the unused portion */
-		if (hold_p_mem_node && temp_resources.p_mem_head) {
+		if (temp_resources.p_mem_head) {
 			p_mem_node = do_pre_bridge_resource_split(&(temp_resources.p_mem_head),
 								  &hold_p_mem_node, 0x100000);
 
-- 
1.8.0


^ permalink raw reply related	[flat|nested] 64+ messages in thread

* [PATCH] bnx2x: use ARRAY_SIZE where possible
  2012-12-20 19:11 [PATCH] tools, power: correct precedence of operators in init_maxfreq_mode Sasha Levin
                   ` (13 preceding siblings ...)
  2012-12-20 19:11 ` [PATCH] PCI: cpqphp: minor cleanup and removal of unreachable paths Sasha Levin
@ 2012-12-20 19:11 ` Sasha Levin
  2012-12-23  8:49   ` Eilon Greenstein
  2012-12-20 19:11 ` [PATCH] wireless: mwifiex: remove unreachable paths Sasha Levin
                   ` (14 subsequent siblings)
  29 siblings, 1 reply; 64+ messages in thread
From: Sasha Levin @ 2012-12-20 19:11 UTC (permalink / raw)
  To: Eilon Greenstein, netdev, linux-kernel; +Cc: Sasha Levin

Signed-off-by: Sasha Levin <sasha.levin@oracle.com>
---
 drivers/net/ethernet/broadcom/bnx2x/bnx2x_link.c | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_link.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_link.c
index 09096b4..cb41f54 100644
--- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_link.c
+++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_link.c
@@ -3659,7 +3659,7 @@ static void bnx2x_warpcore_enable_AN_KR2(struct bnx2x_phy *phy,
 	bnx2x_cl45_read_or_write(bp, phy, MDIO_WC_DEVAD,
 				 MDIO_WC_REG_CL49_USERB0_CTRL, (3<<6));
 
-	for (i = 0; i < sizeof(reg_set)/sizeof(struct bnx2x_reg_set); i++)
+	for (i = 0; i < ARRAY_SIZE(reg_set); i++)
 		bnx2x_cl45_write(bp, phy, reg_set[i].devad, reg_set[i].reg,
 				 reg_set[i].val);
 
@@ -3713,7 +3713,7 @@ static void bnx2x_warpcore_enable_AN_KR(struct bnx2x_phy *phy,
 	};
 	DP(NETIF_MSG_LINK, "Enable Auto Negotiation for KR\n");
 	/* Set to default registers that may be overriden by 10G force */
-	for (i = 0; i < sizeof(reg_set)/sizeof(struct bnx2x_reg_set); i++)
+	for (i = 0; i < ARRAY_SIZE(reg_set); i++)
 		bnx2x_cl45_write(bp, phy, reg_set[i].devad, reg_set[i].reg,
 				 reg_set[i].val);
 
@@ -3854,7 +3854,7 @@ static void bnx2x_warpcore_set_10G_KR(struct bnx2x_phy *phy,
 		{MDIO_PMA_DEVAD, MDIO_WC_REG_PMD_KR_CONTROL, 0x2}
 	};
 
-	for (i = 0; i < sizeof(reg_set)/sizeof(struct bnx2x_reg_set); i++)
+	for (i = 0; i < ARRAY_SIZE(reg_set); i++)
 		bnx2x_cl45_write(bp, phy, reg_set[i].devad, reg_set[i].reg,
 				 reg_set[i].val);
 
@@ -4242,7 +4242,7 @@ static void bnx2x_warpcore_clear_regs(struct bnx2x_phy *phy,
 	bnx2x_cl45_read_or_write(bp, phy, MDIO_WC_DEVAD,
 				 MDIO_WC_REG_RX66_CONTROL, (3<<13));
 
-	for (i = 0; i < sizeof(wc_regs)/sizeof(struct bnx2x_reg_set); i++)
+	for (i = 0; i < ARRAY_SIZE(wc_regs); i++)
 		bnx2x_cl45_write(bp, phy, wc_regs[i].devad, wc_regs[i].reg,
 				 wc_regs[i].val);
 
@@ -9520,7 +9520,7 @@ static void bnx2x_save_848xx_spirom_version(struct bnx2x_phy *phy,
 	} else {
 		/* For 32-bit registers in 848xx, access via MDIO2ARM i/f. */
 		/* (1) set reg 0xc200_0014(SPI_BRIDGE_CTRL_2) to 0x03000000 */
-		for (i = 0; i < sizeof(reg_set)/sizeof(struct bnx2x_reg_set);
+		for (i = 0; i < ARRAY_SIZE(reg_set);
 		      i++)
 			bnx2x_cl45_write(bp, phy, reg_set[i].devad,
 					 reg_set[i].reg, reg_set[i].val);
@@ -9592,7 +9592,7 @@ static void bnx2x_848xx_set_led(struct bnx2x *bp,
 			 MDIO_PMA_DEVAD,
 			 MDIO_PMA_REG_8481_LINK_SIGNAL, val);
 
-	for (i = 0; i < sizeof(reg_set)/sizeof(struct bnx2x_reg_set); i++)
+	for (i = 0; i < ARRAY_SIZE(reg_set); i++)
 		bnx2x_cl45_write(bp, phy, reg_set[i].devad, reg_set[i].reg,
 				 reg_set[i].val);
 
@@ -13395,7 +13395,7 @@ static void bnx2x_disable_kr2(struct link_params *params,
 	};
 	DP(NETIF_MSG_LINK, "Disabling 20G-KR2\n");
 
-	for (i = 0; i < sizeof(reg_set)/sizeof(struct bnx2x_reg_set); i++)
+	for (i = 0; i < ARRAY_SIZE(reg_set); i++)
 		bnx2x_cl45_write(bp, phy, reg_set[i].devad, reg_set[i].reg,
 				 reg_set[i].val);
 	vars->link_attr_sync &= ~LINK_ATTR_SYNC_KR2_ENABLE;
-- 
1.8.0


^ permalink raw reply related	[flat|nested] 64+ messages in thread

* [PATCH] wireless: mwifiex: remove unreachable paths
  2012-12-20 19:11 [PATCH] tools, power: correct precedence of operators in init_maxfreq_mode Sasha Levin
                   ` (14 preceding siblings ...)
  2012-12-20 19:11 ` [PATCH] bnx2x: use ARRAY_SIZE where possible Sasha Levin
@ 2012-12-20 19:11 ` Sasha Levin
  2012-12-20 20:13   ` Bing Zhao
  2012-12-20 19:11 ` [PATCH] mmc: omap_hsmmc: correct precedence of operators Sasha Levin
                   ` (13 subsequent siblings)
  29 siblings, 1 reply; 64+ messages in thread
From: Sasha Levin @ 2012-12-20 19:11 UTC (permalink / raw)
  To: Bing Zhao, John W. Linville, linux-wireless, netdev, linux-kernel
  Cc: Sasha Levin

We know 'firmware' is non-NULL from the beginning of mwifiex_prog_fw_w_helper,
remove all !firmware paths from the rest of the function.

Signed-off-by: Sasha Levin <sasha.levin@oracle.com>
---
 drivers/net/wireless/mwifiex/usb.c | 15 +++------------
 1 file changed, 3 insertions(+), 12 deletions(-)

diff --git a/drivers/net/wireless/mwifiex/usb.c b/drivers/net/wireless/mwifiex/usb.c
index 63ac9f2..8bd7098 100644
--- a/drivers/net/wireless/mwifiex/usb.c
+++ b/drivers/net/wireless/mwifiex/usb.c
@@ -836,23 +836,14 @@ static int mwifiex_prog_fw_w_helper(struct mwifiex_adapter *adapter,
 			dlen = 0;
 		} else {
 			/* copy the header of the fw_data to get the length */
-			if (firmware)
-				memcpy(&fwdata->fw_hdr, &firmware[tlen],
-				       sizeof(struct fw_header));
-			else
-				mwifiex_get_fw_data(adapter, tlen,
-						    sizeof(struct fw_header),
-						    (u8 *)&fwdata->fw_hdr);
+			memcpy(&fwdata->fw_hdr, &firmware[tlen],
+			       sizeof(struct fw_header));
 
 			dlen = le32_to_cpu(fwdata->fw_hdr.data_len);
 			dnld_cmd = le32_to_cpu(fwdata->fw_hdr.dnld_cmd);
 			tlen += sizeof(struct fw_header);
 
-			if (firmware)
-				memcpy(fwdata->data, &firmware[tlen], dlen);
-			else
-				mwifiex_get_fw_data(adapter, tlen, dlen,
-						    (u8 *)fwdata->data);
+			memcpy(fwdata->data, &firmware[tlen], dlen);
 
 			fwdata->seq_num = cpu_to_le32(fw_seqnum);
 			tlen += dlen;
-- 
1.8.0


^ permalink raw reply related	[flat|nested] 64+ messages in thread

* [PATCH] mmc: omap_hsmmc: correct precedence of operators
  2012-12-20 19:11 [PATCH] tools, power: correct precedence of operators in init_maxfreq_mode Sasha Levin
                   ` (15 preceding siblings ...)
  2012-12-20 19:11 ` [PATCH] wireless: mwifiex: remove unreachable paths Sasha Levin
@ 2012-12-20 19:11 ` Sasha Levin
  2012-12-20 20:30   ` Felipe Balbi
  2012-12-20 23:04   ` Paul Walmsley
  2012-12-20 19:11 ` [PATCH] kdb: use ARRAY_SIZE where possible Sasha Levin
                   ` (12 subsequent siblings)
  29 siblings, 2 replies; 64+ messages in thread
From: Sasha Levin @ 2012-12-20 19:11 UTC (permalink / raw)
  To: Venkatraman S, Chris Ball, linux-mmc, linux-omap, linux-kernel
  Cc: Sasha Levin

With the current code, the condition in the if() doesn't make much sense due to
precedence of operators.

Signed-off-by: Sasha Levin <sasha.levin@oracle.com>
---
 drivers/mmc/host/omap_hsmmc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c
index bc58078..3ee2664 100644
--- a/drivers/mmc/host/omap_hsmmc.c
+++ b/drivers/mmc/host/omap_hsmmc.c
@@ -611,7 +611,7 @@ static int omap_hsmmc_context_restore(struct omap_hsmmc_host *host)
 	if (host->context_loss == context_loss)
 		return 1;
 
-	if (!OMAP_HSMMC_READ(host->base, SYSSTATUS) & RESETDONE)
+	if (!(OMAP_HSMMC_READ(host->base, SYSSTATUS) & RESETDONE))
 		return 1;
 
 	if (host->pdata->controller_flags & OMAP_HSMMC_SUPPORTS_DUAL_VOLT) {
-- 
1.8.0


^ permalink raw reply related	[flat|nested] 64+ messages in thread

* [PATCH] kdb: use ARRAY_SIZE where possible
  2012-12-20 19:11 [PATCH] tools, power: correct precedence of operators in init_maxfreq_mode Sasha Levin
                   ` (16 preceding siblings ...)
  2012-12-20 19:11 ` [PATCH] mmc: omap_hsmmc: correct precedence of operators Sasha Levin
@ 2012-12-20 19:11 ` Sasha Levin
  2012-12-20 19:11 ` [PATCH] rcutorture: don't compare ptr with 0 Sasha Levin
                   ` (11 subsequent siblings)
  29 siblings, 0 replies; 64+ messages in thread
From: Sasha Levin @ 2012-12-20 19:11 UTC (permalink / raw)
  To: Jason Wessel, Anton Vorontsov, Sasha Levin, Eric Dumazet,
	Rusty Russell, kgdb-bugreport, linux-kernel

Signed-off-by: Sasha Levin <sasha.levin@oracle.com>
---
 kernel/debug/kdb/kdb_main.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/kernel/debug/kdb/kdb_main.c b/kernel/debug/kdb/kdb_main.c
index 4d5f8d5..18ce064 100644
--- a/kernel/debug/kdb/kdb_main.c
+++ b/kernel/debug/kdb/kdb_main.c
@@ -124,7 +124,7 @@ static kdbmsg_t kdbmsgs[] = {
 };
 #undef KDBMSG
 
-static const int __nkdb_err = sizeof(kdbmsgs) / sizeof(kdbmsg_t);
+static const int __nkdb_err = ARRAY_SIZE(kdbmsgs);
 
 
 /*
@@ -175,7 +175,7 @@ static char *__env[] = {
  (char *)0,
 };
 
-static const int __nenv = (sizeof(__env) / sizeof(char *));
+static const int __nenv = ARRAY_SIZE(__env);
 
 struct task_struct *kdb_curr_task(int cpu)
 {
-- 
1.8.0


^ permalink raw reply related	[flat|nested] 64+ messages in thread

* [PATCH] rcutorture: don't compare ptr with 0
  2012-12-20 19:11 [PATCH] tools, power: correct precedence of operators in init_maxfreq_mode Sasha Levin
                   ` (17 preceding siblings ...)
  2012-12-20 19:11 ` [PATCH] kdb: use ARRAY_SIZE where possible Sasha Levin
@ 2012-12-20 19:11 ` Sasha Levin
  2012-12-20 22:39   ` Josh Triplett
  2012-12-20 19:11 ` [PATCH] sched: fair: simplify can_migrate_task a bit Sasha Levin
                   ` (10 subsequent siblings)
  29 siblings, 1 reply; 64+ messages in thread
From: Sasha Levin @ 2012-12-20 19:11 UTC (permalink / raw)
  To: Josh Triplett, Paul E. McKenney, linux-kernel; +Cc: Sasha Levin

Signed-off-by: Sasha Levin <sasha.levin@oracle.com>
---
 kernel/rcutorture.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/rcutorture.c b/kernel/rcutorture.c
index 31dea01..0249800 100644
--- a/kernel/rcutorture.c
+++ b/kernel/rcutorture.c
@@ -1749,7 +1749,7 @@ static int rcu_torture_barrier_init(void)
 	barrier_cbs_wq =
 		kzalloc(n_barrier_cbs * sizeof(barrier_cbs_wq[0]),
 			GFP_KERNEL);
-	if (barrier_cbs_tasks == NULL || barrier_cbs_wq == 0)
+	if (barrier_cbs_tasks == NULL || !barrier_cbs_wq)
 		return -ENOMEM;
 	for (i = 0; i < n_barrier_cbs; i++) {
 		init_waitqueue_head(&barrier_cbs_wq[i]);
-- 
1.8.0


^ permalink raw reply related	[flat|nested] 64+ messages in thread

* [PATCH] sched: fair: simplify can_migrate_task a bit
  2012-12-20 19:11 [PATCH] tools, power: correct precedence of operators in init_maxfreq_mode Sasha Levin
                   ` (18 preceding siblings ...)
  2012-12-20 19:11 ` [PATCH] rcutorture: don't compare ptr with 0 Sasha Levin
@ 2012-12-20 19:11 ` Sasha Levin
  2012-12-20 19:11 ` [PATCH] uprobes: remove redundant check Sasha Levin
                   ` (9 subsequent siblings)
  29 siblings, 0 replies; 64+ messages in thread
From: Sasha Levin @ 2012-12-20 19:11 UTC (permalink / raw)
  To: Ingo Molnar, Peter Zijlstra, linux-kernel; +Cc: Sasha Levin

We already know that tsk_cache_hot is true at the end of
can_migrate_task, no need to double check that.

Signed-off-by: Sasha Levin <sasha.levin@oracle.com>
---
 kernel/sched/fair.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
index 4603d6c..e03940e0 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -3935,11 +3935,8 @@ int can_migrate_task(struct task_struct *p, struct lb_env *env)
 		return 1;
 	}
 
-	if (tsk_cache_hot) {
-		schedstat_inc(p, se.statistics.nr_failed_migrations_hot);
-		return 0;
-	}
-	return 1;
+	schedstat_inc(p, se.statistics.nr_failed_migrations_hot);
+	return 0;
 }
 
 /*
-- 
1.8.0


^ permalink raw reply related	[flat|nested] 64+ messages in thread

* [PATCH] uprobes: remove redundant check
  2012-12-20 19:11 [PATCH] tools, power: correct precedence of operators in init_maxfreq_mode Sasha Levin
                   ` (19 preceding siblings ...)
  2012-12-20 19:11 ` [PATCH] sched: fair: simplify can_migrate_task a bit Sasha Levin
@ 2012-12-20 19:11 ` Sasha Levin
  2013-01-25 11:21   ` [tip:perf/core] " tip-bot for Sasha Levin
  2012-12-20 19:11 ` [PATCH] cgroup: " Sasha Levin
                   ` (8 subsequent siblings)
  29 siblings, 1 reply; 64+ messages in thread
From: Sasha Levin @ 2012-12-20 19:11 UTC (permalink / raw)
  To: Peter Zijlstra, Paul Mackerras, Ingo Molnar,
	Arnaldo Carvalho de Melo, linux-kernel
  Cc: Sasha Levin

We checked for uprobe==NULL earlier, no need to redo that.

Signed-off-by: Sasha Levin <sasha.levin@oracle.com>
---
 kernel/events/uprobes.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/kernel/events/uprobes.c b/kernel/events/uprobes.c
index dea7acf..30ea9a4 100644
--- a/kernel/events/uprobes.c
+++ b/kernel/events/uprobes.c
@@ -901,8 +901,7 @@ void uprobe_unregister(struct inode *inode, loff_t offset, struct uprobe_consume
 	}
 
 	mutex_unlock(uprobes_hash(inode));
-	if (uprobe)
-		put_uprobe(uprobe);
+	put_uprobe(uprobe);
 }
 
 static struct rb_node *
-- 
1.8.0


^ permalink raw reply related	[flat|nested] 64+ messages in thread

* [PATCH] cgroup: remove redundant check
  2012-12-20 19:11 [PATCH] tools, power: correct precedence of operators in init_maxfreq_mode Sasha Levin
                   ` (20 preceding siblings ...)
  2012-12-20 19:11 ` [PATCH] uprobes: remove redundant check Sasha Levin
@ 2012-12-20 19:11 ` Sasha Levin
  2012-12-20 19:18   ` Tejun Heo
  2012-12-20 19:11 ` [PATCH] mm: memory_hotplug: no need to check res twice in add_memory Sasha Levin
                   ` (7 subsequent siblings)
  29 siblings, 1 reply; 64+ messages in thread
From: Sasha Levin @ 2012-12-20 19:11 UTC (permalink / raw)
  To: Tejun Heo, Li Zefan, containers, cgroups, linux-kernel; +Cc: Sasha Levin

We already know that 'event' is non-NULL, remove the redundant check.

Signed-off-by: Sasha Levin <sasha.levin@oracle.com>
---
 kernel/cgroup.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/cgroup.c b/kernel/cgroup.c
index 4855892..8d6c3f2 100644
--- a/kernel/cgroup.c
+++ b/kernel/cgroup.c
@@ -3898,7 +3898,7 @@ fail:
 	if (cfile)
 		fput(cfile);
 
-	if (event && event->eventfd && !IS_ERR(event->eventfd))
+	if (event->eventfd && !IS_ERR(event->eventfd))
 		eventfd_ctx_put(event->eventfd);
 
 	if (!IS_ERR_OR_NULL(efile))
-- 
1.8.0


^ permalink raw reply related	[flat|nested] 64+ messages in thread

* [PATCH] mm: memory_hotplug: no need to check res twice in add_memory
  2012-12-20 19:11 [PATCH] tools, power: correct precedence of operators in init_maxfreq_mode Sasha Levin
                   ` (21 preceding siblings ...)
  2012-12-20 19:11 ` [PATCH] cgroup: " Sasha Levin
@ 2012-12-20 19:11 ` Sasha Levin
  2012-12-20 19:11 ` [PATCH] x86, efi: correct precedence of operators in setup_efi_pci Sasha Levin
                   ` (6 subsequent siblings)
  29 siblings, 0 replies; 64+ messages in thread
From: Sasha Levin @ 2012-12-20 19:11 UTC (permalink / raw)
  To: Andrew Morton, Wen Congyang, Jiang Liu, Lai Jiangshan,
	Yasuaki Ishimatsu, linux-mm, linux-kernel
  Cc: Sasha Levin

Remove one redundant check of res.

Signed-off-by: Sasha Levin <sasha.levin@oracle.com>
---
 mm/memory_hotplug.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c
index 962e353..4082244 100644
--- a/mm/memory_hotplug.c
+++ b/mm/memory_hotplug.c
@@ -898,8 +898,7 @@ error:
 	/* rollback pgdat allocation and others */
 	if (new_pgdat)
 		rollback_node_hotadd(nid, pgdat);
-	if (res)
-		release_memory_resource(res);
+	release_memory_resource(res);
 
 out:
 	unlock_memory_hotplug();
-- 
1.8.0


^ permalink raw reply related	[flat|nested] 64+ messages in thread

* [PATCH] x86, efi: correct precedence of operators in setup_efi_pci
  2012-12-20 19:11 [PATCH] tools, power: correct precedence of operators in init_maxfreq_mode Sasha Levin
                   ` (22 preceding siblings ...)
  2012-12-20 19:11 ` [PATCH] mm: memory_hotplug: no need to check res twice in add_memory Sasha Levin
@ 2012-12-20 19:11 ` Sasha Levin
  2012-12-20 19:59   ` [tip:x86/urgent] " tip-bot for Sasha Levin
  2012-12-20 19:11 ` [PATCH] arch/x86/platform/uv: use ARRAY_SIZE where possible Sasha Levin
                   ` (5 subsequent siblings)
  29 siblings, 1 reply; 64+ messages in thread
From: Sasha Levin @ 2012-12-20 19:11 UTC (permalink / raw)
  To: Matt Fleming, H. Peter Anvin, Thomas Gleixner, Ingo Molnar, x86,
	linux-efi, linux-kernel
  Cc: Sasha Levin

With the current code, the condition in the if() doesn't make much sense due to
precedence of operators.

Signed-off-by: Sasha Levin <sasha.levin@oracle.com>
---
 arch/x86/boot/compressed/eboot.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/x86/boot/compressed/eboot.c b/arch/x86/boot/compressed/eboot.c
index b1942e2..18e329c 100644
--- a/arch/x86/boot/compressed/eboot.c
+++ b/arch/x86/boot/compressed/eboot.c
@@ -302,7 +302,7 @@ static efi_status_t setup_efi_pci(struct boot_params *params)
 		if (status != EFI_SUCCESS)
 			continue;
 
-		if (!attributes & EFI_PCI_IO_ATTRIBUTE_EMBEDDED_ROM)
+		if (!(attributes & EFI_PCI_IO_ATTRIBUTE_EMBEDDED_ROM))
 			continue;
 
 		if (!pci->romimage || !pci->romsize)
-- 
1.8.0


^ permalink raw reply related	[flat|nested] 64+ messages in thread

* [PATCH] arch/x86/platform/uv: use ARRAY_SIZE where possible
  2012-12-20 19:11 [PATCH] tools, power: correct precedence of operators in init_maxfreq_mode Sasha Levin
                   ` (23 preceding siblings ...)
  2012-12-20 19:11 ` [PATCH] x86, efi: correct precedence of operators in setup_efi_pci Sasha Levin
@ 2012-12-20 19:11 ` Sasha Levin
  2012-12-20 22:37   ` [tip:x86/cleanups] " tip-bot for Sasha Levin
  2012-12-20 19:11 ` [PATCH] um: don't compare a pointer to 0 Sasha Levin
                   ` (4 subsequent siblings)
  29 siblings, 1 reply; 64+ messages in thread
From: Sasha Levin @ 2012-12-20 19:11 UTC (permalink / raw)
  To: Thomas Gleixner, Ingo Molnar, H. Peter Anvin, x86, Cliff Wickman,
	Alex Shi, Sasha Levin, Andrew Morton, linux-kernel

Signed-off-by: Sasha Levin <sasha.levin@oracle.com>
---
 arch/x86/platform/uv/tlb_uv.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/x86/platform/uv/tlb_uv.c b/arch/x86/platform/uv/tlb_uv.c
index dbbdca5..0f92173 100644
--- a/arch/x86/platform/uv/tlb_uv.c
+++ b/arch/x86/platform/uv/tlb_uv.c
@@ -1467,7 +1467,7 @@ static ssize_t ptc_proc_write(struct file *file, const char __user *user,
 	}
 
 	if (input_arg == 0) {
-		elements = sizeof(stat_description)/sizeof(*stat_description);
+		elements = ARRAY_SIZE(stat_description);
 		printk(KERN_DEBUG "# cpu:      cpu number\n");
 		printk(KERN_DEBUG "Sender statistics:\n");
 		for (i = 0; i < elements; i++)
@@ -1508,7 +1508,7 @@ static int parse_tunables_write(struct bau_control *bcp, char *instr,
 	char *q;
 	int cnt = 0;
 	int val;
-	int e = sizeof(tunables) / sizeof(*tunables);
+	int e = ARRAY_SIZE(tunables);
 
 	p = instr + strspn(instr, WHITESPACE);
 	q = p;
-- 
1.8.0


^ permalink raw reply related	[flat|nested] 64+ messages in thread

* [PATCH] um: don't compare a pointer to 0
  2012-12-20 19:11 [PATCH] tools, power: correct precedence of operators in init_maxfreq_mode Sasha Levin
                   ` (24 preceding siblings ...)
  2012-12-20 19:11 ` [PATCH] arch/x86/platform/uv: use ARRAY_SIZE where possible Sasha Levin
@ 2012-12-20 19:11 ` Sasha Levin
  2012-12-20 22:39   ` [tip:x86/cleanups] " tip-bot for Sasha Levin
  2012-12-20 19:11 ` [PATCH] x86, apb_timer: remove unused variable percpu_timer Sasha Levin
                   ` (3 subsequent siblings)
  29 siblings, 1 reply; 64+ messages in thread
From: Sasha Levin @ 2012-12-20 19:11 UTC (permalink / raw)
  To: Jeff Dike, Richard Weinberger, Thomas Gleixner, Ingo Molnar,
	H. Peter Anvin, x86, user-mode-linux-devel, user-mode-linux-user,
	linux-kernel
  Cc: Sasha Levin

Signed-off-by: Sasha Levin <sasha.levin@oracle.com>
---
 arch/x86/um/fault.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/x86/um/fault.c b/arch/x86/um/fault.c
index 8784ab3..84ac7f7 100644
--- a/arch/x86/um/fault.c
+++ b/arch/x86/um/fault.c
@@ -20,7 +20,7 @@ int arch_fixup(unsigned long address, struct uml_pt_regs *regs)
 	const struct exception_table_entry *fixup;
 
 	fixup = search_exception_tables(address);
-	if (fixup != 0) {
+	if (fixup) {
 		UPT_IP(regs) = fixup->fixup;
 		return 1;
 	}
-- 
1.8.0


^ permalink raw reply related	[flat|nested] 64+ messages in thread

* [PATCH] x86, apb_timer: remove unused variable percpu_timer
  2012-12-20 19:11 [PATCH] tools, power: correct precedence of operators in init_maxfreq_mode Sasha Levin
                   ` (25 preceding siblings ...)
  2012-12-20 19:11 ` [PATCH] um: don't compare a pointer to 0 Sasha Levin
@ 2012-12-20 19:11 ` Sasha Levin
  2012-12-20 22:40   ` [tip:x86/cleanups] " tip-bot for Sasha Levin
  2012-12-20 19:11 ` [PATCH] kdb: use DIV_ROUND_UP where possible Sasha Levin
                   ` (2 subsequent siblings)
  29 siblings, 1 reply; 64+ messages in thread
From: Sasha Levin @ 2012-12-20 19:11 UTC (permalink / raw)
  To: Thomas Gleixner, Ingo Molnar, H. Peter Anvin, x86, Sasha Levin,
	linux-kernel

Signed-off-by: Sasha Levin <sasha.levin@oracle.com>
---
 arch/x86/kernel/apb_timer.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/arch/x86/kernel/apb_timer.c b/arch/x86/kernel/apb_timer.c
index afdc3f75..cc74fd0 100644
--- a/arch/x86/kernel/apb_timer.c
+++ b/arch/x86/kernel/apb_timer.c
@@ -311,7 +311,6 @@ void __init apbt_time_init(void)
 #ifdef CONFIG_SMP
 	int i;
 	struct sfi_timer_table_entry *p_mtmr;
-	unsigned int percpu_timer;
 	struct apbt_dev *adev;
 #endif
 
@@ -346,13 +345,10 @@ void __init apbt_time_init(void)
 		return;
 	}
 	pr_debug("%s: %d CPUs online\n", __func__, num_online_cpus());
-	if (num_possible_cpus() <= sfi_mtimer_num) {
-		percpu_timer = 1;
+	if (num_possible_cpus() <= sfi_mtimer_num)
 		apbt_num_timers_used = num_possible_cpus();
-	} else {
-		percpu_timer = 0;
+	else
 		apbt_num_timers_used = 1;
-	}
 	pr_debug("%s: %d APB timers used\n", __func__, apbt_num_timers_used);
 
 	/* here we set up per CPU timer data structure */
-- 
1.8.0


^ permalink raw reply related	[flat|nested] 64+ messages in thread

* [PATCH] kdb: use DIV_ROUND_UP where possible
  2012-12-20 19:11 [PATCH] tools, power: correct precedence of operators in init_maxfreq_mode Sasha Levin
                   ` (26 preceding siblings ...)
  2012-12-20 19:11 ` [PATCH] x86, apb_timer: remove unused variable percpu_timer Sasha Levin
@ 2012-12-20 19:11 ` Sasha Levin
  2012-12-20 19:11 ` [PATCH] mm/sparse: don't check return value of alloc_bootmem calls Sasha Levin
  2012-12-20 19:11 ` [PATCH] slob: use DIV_ROUND_UP where possible Sasha Levin
  29 siblings, 0 replies; 64+ messages in thread
From: Sasha Levin @ 2012-12-20 19:11 UTC (permalink / raw)
  To: Jason Wessel, Anton Vorontsov, Sasha Levin, Eric Dumazet,
	Rusty Russell, kgdb-bugreport, linux-kernel

Signed-off-by: Sasha Levin <sasha.levin@oracle.com>
---
 kernel/debug/kdb/kdb_main.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/debug/kdb/kdb_main.c b/kernel/debug/kdb/kdb_main.c
index 18ce064..199abdc 100644
--- a/kernel/debug/kdb/kdb_main.c
+++ b/kernel/debug/kdb/kdb_main.c
@@ -1670,7 +1670,7 @@ static int kdb_md(int argc, const char **argv)
 			    num, repeat, phys);
 		addr += bytesperword * n;
 		repeat -= n;
-		z = (z + num - 1) / num;
+		z = DIV_ROUND_UP(z, num);
 		if (z > 2) {
 			int s = num * (z-2);
 			kdb_printf(kdb_machreg_fmt0 "-" kdb_machreg_fmt0
-- 
1.8.0


^ permalink raw reply related	[flat|nested] 64+ messages in thread

* [PATCH] mm/sparse: don't check return value of alloc_bootmem calls
  2012-12-20 19:11 [PATCH] tools, power: correct precedence of operators in init_maxfreq_mode Sasha Levin
                   ` (27 preceding siblings ...)
  2012-12-20 19:11 ` [PATCH] kdb: use DIV_ROUND_UP where possible Sasha Levin
@ 2012-12-20 19:11 ` Sasha Levin
  2012-12-20 20:23   ` David Rientjes
  2012-12-20 19:11 ` [PATCH] slob: use DIV_ROUND_UP where possible Sasha Levin
  29 siblings, 1 reply; 64+ messages in thread
From: Sasha Levin @ 2012-12-20 19:11 UTC (permalink / raw)
  To: Andrew Morton, Johannes Weiner, Michal Hocko, Gavin Shan,
	David Rientjes, linux-mm, linux-kernel
  Cc: Sasha Levin

These calls will panic if they can't allocate the memory, so we can
assume that we get actual memory back. This simplifies some functions
and removes unneeded checks.

Signed-off-by: Sasha Levin <sasha.levin@oracle.com>
---
 mm/sparse.c | 18 ++++++------------
 1 file changed, 6 insertions(+), 12 deletions(-)

diff --git a/mm/sparse.c b/mm/sparse.c
index 6b5fb76..ae64d6e 100644
--- a/mm/sparse.c
+++ b/mm/sparse.c
@@ -403,15 +403,13 @@ void __init sparse_mem_maps_populate_node(struct page **map_map,
 	size = PAGE_ALIGN(size);
 	map = __alloc_bootmem_node_high(NODE_DATA(nodeid), size * map_count,
 					 PAGE_SIZE, __pa(MAX_DMA_ADDRESS));
-	if (map) {
-		for (pnum = pnum_begin; pnum < pnum_end; pnum++) {
-			if (!present_section_nr(pnum))
-				continue;
-			map_map[pnum] = map;
-			map += size;
-		}
-		return;
+	for (pnum = pnum_begin; pnum < pnum_end; pnum++) {
+		if (!present_section_nr(pnum))
+			continue;
+		map_map[pnum] = map;
+		map += size;
 	}
+	return;
 
 	/* fallback */
 	for (pnum = pnum_begin; pnum < pnum_end; pnum++) {
@@ -497,8 +495,6 @@ void __init sparse_init(void)
 	 */
 	size = sizeof(unsigned long *) * NR_MEM_SECTIONS;
 	usemap_map = alloc_bootmem(size);
-	if (!usemap_map)
-		panic("can not allocate usemap_map\n");
 
 	for (pnum = 0; pnum < NR_MEM_SECTIONS; pnum++) {
 		struct mem_section *ms;
@@ -538,8 +534,6 @@ void __init sparse_init(void)
 #ifdef CONFIG_SPARSEMEM_ALLOC_MEM_MAP_TOGETHER
 	size2 = sizeof(struct page *) * NR_MEM_SECTIONS;
 	map_map = alloc_bootmem(size2);
-	if (!map_map)
-		panic("can not allocate map_map\n");
 
 	for (pnum = 0; pnum < NR_MEM_SECTIONS; pnum++) {
 		struct mem_section *ms;
-- 
1.8.0


^ permalink raw reply related	[flat|nested] 64+ messages in thread

* [PATCH] slob: use DIV_ROUND_UP where possible
  2012-12-20 19:11 [PATCH] tools, power: correct precedence of operators in init_maxfreq_mode Sasha Levin
                   ` (28 preceding siblings ...)
  2012-12-20 19:11 ` [PATCH] mm/sparse: don't check return value of alloc_bootmem calls Sasha Levin
@ 2012-12-20 19:11 ` Sasha Levin
  2012-12-20 19:40   ` Christoph Lameter
  29 siblings, 1 reply; 64+ messages in thread
From: Sasha Levin @ 2012-12-20 19:11 UTC (permalink / raw)
  To: Christoph Lameter, Pekka Enberg, Matt Mackall, linux-mm, linux-kernel
  Cc: Sasha Levin

Signed-off-by: Sasha Levin <sasha.levin@oracle.com>
---
 mm/slob.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/mm/slob.c b/mm/slob.c
index a99fdf7..f729c46 100644
--- a/mm/slob.c
+++ b/mm/slob.c
@@ -122,7 +122,7 @@ static inline void clear_slob_page_free(struct page *sp)
 }
 
 #define SLOB_UNIT sizeof(slob_t)
-#define SLOB_UNITS(size) (((size) + SLOB_UNIT - 1)/SLOB_UNIT)
+#define SLOB_UNITS(size) DIV_ROUND_UP(size, SLOB_UNIT)
 
 /*
  * struct slob_rcu is inserted at the tail of allocated slob blocks, which
-- 
1.8.0


^ permalink raw reply related	[flat|nested] 64+ messages in thread

* Re: [PATCH] cgroup: remove redundant check
  2012-12-20 19:11 ` [PATCH] cgroup: " Sasha Levin
@ 2012-12-20 19:18   ` Tejun Heo
  2012-12-20 19:24     ` Sasha Levin
  0 siblings, 1 reply; 64+ messages in thread
From: Tejun Heo @ 2012-12-20 19:18 UTC (permalink / raw)
  To: Sasha Levin; +Cc: Li Zefan, containers, cgroups, linux-kernel

On Thu, Dec 20, 2012 at 02:11:31PM -0500, Sasha Levin wrote:
> We already know that 'event' is non-NULL, remove the redundant check.
> 
> Signed-off-by: Sasha Levin <sasha.levin@oracle.com>

I don't know.  I kinda like that test there.  It's not an error path
and tearing down everything which could have been allocated.  If the
test not being used is bothering, convert return -ENOMEM to goto fail?

-- 
tejun

^ permalink raw reply	[flat|nested] 64+ messages in thread

* Re: [PATCH] cgroup: remove redundant check
  2012-12-20 19:18   ` Tejun Heo
@ 2012-12-20 19:24     ` Sasha Levin
  0 siblings, 0 replies; 64+ messages in thread
From: Sasha Levin @ 2012-12-20 19:24 UTC (permalink / raw)
  To: Tejun Heo; +Cc: Li Zefan, containers, cgroups, linux-kernel

On 12/20/2012 02:18 PM, Tejun Heo wrote:
> On Thu, Dec 20, 2012 at 02:11:31PM -0500, Sasha Levin wrote:
>> We already know that 'event' is non-NULL, remove the redundant check.
>>
>> Signed-off-by: Sasha Levin <sasha.levin@oracle.com>
> 
> I don't know.  I kinda like that test there.  It's not an error path
> and tearing down everything which could have been allocated.  If the
> test not being used is bothering, convert return -ENOMEM to goto fail?

Can't say it's bothering. If you'd prefer to leave it as is I'm okay with
doing that.


Thanks,
Sasha


^ permalink raw reply	[flat|nested] 64+ messages in thread

* Re: [PATCH] slob: use DIV_ROUND_UP where possible
  2012-12-20 19:11 ` [PATCH] slob: use DIV_ROUND_UP where possible Sasha Levin
@ 2012-12-20 19:40   ` Christoph Lameter
  0 siblings, 0 replies; 64+ messages in thread
From: Christoph Lameter @ 2012-12-20 19:40 UTC (permalink / raw)
  To: Sasha Levin; +Cc: Pekka Enberg, Matt Mackall, linux-mm, linux-kernel

Obviously good.

Acked-by: Christoph Lameter <cl@linux.com>


^ permalink raw reply	[flat|nested] 64+ messages in thread

* [tip:x86/urgent] x86, efi: correct precedence of operators in setup_efi_pci
  2012-12-20 19:11 ` [PATCH] x86, efi: correct precedence of operators in setup_efi_pci Sasha Levin
@ 2012-12-20 19:59   ` tip-bot for Sasha Levin
  0 siblings, 0 replies; 64+ messages in thread
From: tip-bot for Sasha Levin @ 2012-12-20 19:59 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: mjg, linux-kernel, sasha.levin, hpa, mingo, seth.forshee,
	matt.fleming, bhelgaas, tglx, hpa

Commit-ID:  886d751a2ea99a160f2d0a472231566d9cb0cf58
Gitweb:     http://git.kernel.org/tip/886d751a2ea99a160f2d0a472231566d9cb0cf58
Author:     Sasha Levin <sasha.levin@oracle.com>
AuthorDate: Thu, 20 Dec 2012 14:11:33 -0500
Committer:  H. Peter Anvin <hpa@linux.intel.com>
CommitDate: Thu, 20 Dec 2012 11:47:14 -0800

x86, efi: correct precedence of operators in setup_efi_pci

With the current code, the condition in the if() doesn't make much sense due to
precedence of operators.

Signed-off-by: Sasha Levin <sasha.levin@oracle.com>
Link: http://lkml.kernel.org/r/1356030701-16284-25-git-send-email-sasha.levin@oracle.com
Cc: Matt Fleming <matt.fleming@intel.com>
Cc: Matthew Garrett <mjg@redhat.com>
Cc: Bjorn Helgaas <bhelgaas@google.com>
Cc: Seth Forshee <seth.forshee@canonical.com>
Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
---
 arch/x86/boot/compressed/eboot.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/x86/boot/compressed/eboot.c b/arch/x86/boot/compressed/eboot.c
index b1942e2..18e329c 100644
--- a/arch/x86/boot/compressed/eboot.c
+++ b/arch/x86/boot/compressed/eboot.c
@@ -302,7 +302,7 @@ static efi_status_t setup_efi_pci(struct boot_params *params)
 		if (status != EFI_SUCCESS)
 			continue;
 
-		if (!attributes & EFI_PCI_IO_ATTRIBUTE_EMBEDDED_ROM)
+		if (!(attributes & EFI_PCI_IO_ATTRIBUTE_EMBEDDED_ROM))
 			continue;
 
 		if (!pci->romimage || !pci->romsize)

^ permalink raw reply related	[flat|nested] 64+ messages in thread

* RE: [PATCH] wireless: mwifiex: remove unreachable paths
  2012-12-20 19:11 ` [PATCH] wireless: mwifiex: remove unreachable paths Sasha Levin
@ 2012-12-20 20:13   ` Bing Zhao
  0 siblings, 0 replies; 64+ messages in thread
From: Bing Zhao @ 2012-12-20 20:13 UTC (permalink / raw)
  To: Sasha Levin; +Cc: John W. Linville, linux-wireless, netdev, linux-kernel

Hi Sasha,

Thanks for the patch.

> We know 'firmware' is non-NULL from the beginning of mwifiex_prog_fw_w_helper,
> remove all !firmware paths from the rest of the function.

After removing all !firmware paths the function 'mwifiex_get_fw_data' becomes an orphan.

Could you please remove that function as well and resend a v2 patch?

Thanks,
Bing

> 
> Signed-off-by: Sasha Levin <sasha.levin@oracle.com>
> ---
>  drivers/net/wireless/mwifiex/usb.c | 15 +++------------
>  1 file changed, 3 insertions(+), 12 deletions(-)
> 
> diff --git a/drivers/net/wireless/mwifiex/usb.c b/drivers/net/wireless/mwifiex/usb.c
> index 63ac9f2..8bd7098 100644
> --- a/drivers/net/wireless/mwifiex/usb.c
> +++ b/drivers/net/wireless/mwifiex/usb.c
> @@ -836,23 +836,14 @@ static int mwifiex_prog_fw_w_helper(struct mwifiex_adapter *adapter,
>  			dlen = 0;
>  		} else {
>  			/* copy the header of the fw_data to get the length */
> -			if (firmware)
> -				memcpy(&fwdata->fw_hdr, &firmware[tlen],
> -				       sizeof(struct fw_header));
> -			else
> -				mwifiex_get_fw_data(adapter, tlen,
> -						    sizeof(struct fw_header),
> -						    (u8 *)&fwdata->fw_hdr);
> +			memcpy(&fwdata->fw_hdr, &firmware[tlen],
> +			       sizeof(struct fw_header));
> 
>  			dlen = le32_to_cpu(fwdata->fw_hdr.data_len);
>  			dnld_cmd = le32_to_cpu(fwdata->fw_hdr.dnld_cmd);
>  			tlen += sizeof(struct fw_header);
> 
> -			if (firmware)
> -				memcpy(fwdata->data, &firmware[tlen], dlen);
> -			else
> -				mwifiex_get_fw_data(adapter, tlen, dlen,
> -						    (u8 *)fwdata->data);
> +			memcpy(fwdata->data, &firmware[tlen], dlen);
> 
>  			fwdata->seq_num = cpu_to_le32(fw_seqnum);
>  			tlen += dlen;
> --
> 1.8.0


^ permalink raw reply	[flat|nested] 64+ messages in thread

* Re: [PATCH] mm/sparse: don't check return value of alloc_bootmem calls
  2012-12-20 19:11 ` [PATCH] mm/sparse: don't check return value of alloc_bootmem calls Sasha Levin
@ 2012-12-20 20:23   ` David Rientjes
  2012-12-20 20:36     ` Sasha Levin
  0 siblings, 1 reply; 64+ messages in thread
From: David Rientjes @ 2012-12-20 20:23 UTC (permalink / raw)
  To: Sasha Levin
  Cc: Andrew Morton, Johannes Weiner, Michal Hocko, Gavin Shan,
	linux-mm, linux-kernel

On Thu, 20 Dec 2012, Sasha Levin wrote:

> diff --git a/mm/sparse.c b/mm/sparse.c
> index 6b5fb76..ae64d6e 100644
> --- a/mm/sparse.c
> +++ b/mm/sparse.c
> @@ -403,15 +403,13 @@ void __init sparse_mem_maps_populate_node(struct page **map_map,
>  	size = PAGE_ALIGN(size);
>  	map = __alloc_bootmem_node_high(NODE_DATA(nodeid), size * map_count,
>  					 PAGE_SIZE, __pa(MAX_DMA_ADDRESS));
> -	if (map) {
> -		for (pnum = pnum_begin; pnum < pnum_end; pnum++) {
> -			if (!present_section_nr(pnum))
> -				continue;
> -			map_map[pnum] = map;
> -			map += size;
> -		}
> -		return;
> +	for (pnum = pnum_begin; pnum < pnum_end; pnum++) {
> +		if (!present_section_nr(pnum))
> +			continue;
> +		map_map[pnum] = map;
> +		map += size;
>  	}
> +	return;
>  
>  	/* fallback */
>  	for (pnum = pnum_begin; pnum < pnum_end; pnum++) {

That's not true when slab_is_available() and why would you possibly add a 
return statement right before fallback code in such cases?

^ permalink raw reply	[flat|nested] 64+ messages in thread

* Re: [PATCH] mmc: omap_hsmmc: correct precedence of operators
  2012-12-20 19:11 ` [PATCH] mmc: omap_hsmmc: correct precedence of operators Sasha Levin
@ 2012-12-20 20:30   ` Felipe Balbi
  2012-12-20 23:04   ` Paul Walmsley
  1 sibling, 0 replies; 64+ messages in thread
From: Felipe Balbi @ 2012-12-20 20:30 UTC (permalink / raw)
  To: Sasha Levin
  Cc: Venkatraman S, Chris Ball, linux-mmc, linux-omap, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 1255 bytes --]

On Thu, Dec 20, 2012 at 02:11:26PM -0500, Sasha Levin wrote:
> With the current code, the condition in the if() doesn't make much sense due to
> precedence of operators.
> 
> Signed-off-by: Sasha Levin <sasha.levin@oracle.com>

nice catch!!!

Acked-by: Felipe Balbi <balbi@ti.com>

> ---
>  drivers/mmc/host/omap_hsmmc.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c
> index bc58078..3ee2664 100644
> --- a/drivers/mmc/host/omap_hsmmc.c
> +++ b/drivers/mmc/host/omap_hsmmc.c
> @@ -611,7 +611,7 @@ static int omap_hsmmc_context_restore(struct omap_hsmmc_host *host)
>  	if (host->context_loss == context_loss)
>  		return 1;
>  
> -	if (!OMAP_HSMMC_READ(host->base, SYSSTATUS) & RESETDONE)
> +	if (!(OMAP_HSMMC_READ(host->base, SYSSTATUS) & RESETDONE))
>  		return 1;
>  
>  	if (host->pdata->controller_flags & OMAP_HSMMC_SUPPORTS_DUAL_VOLT) {
> -- 
> 1.8.0
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at  http://www.tux.org/lkml/

-- 
balbi

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

^ permalink raw reply	[flat|nested] 64+ messages in thread

* Re: [PATCH] tools/usb: remove unneeded 'continue' and simplify condition
  2012-12-20 19:11 ` [PATCH] tools/usb: remove unneeded 'continue' and simplify condition Sasha Levin
@ 2012-12-20 20:32   ` Felipe Balbi
  0 siblings, 0 replies; 64+ messages in thread
From: Felipe Balbi @ 2012-12-20 20:32 UTC (permalink / raw)
  To: Sasha Levin
  Cc: Greg Kroah-Hartman, Du Changbin, Michal Nazarewicz, Felipe Balbi,
	linux-kernel

[-- Attachment #1: Type: text/plain, Size: 863 bytes --]

On Thu, Dec 20, 2012 at 02:11:15PM -0500, Sasha Levin wrote:
> Basically remove unneeded code. Since that 'continue' is at the end
> of the for() there's no need for it.
> 
> Signed-off-by: Sasha Levin <sasha.levin@oracle.com>

Acked-by: Felipe Balbi <balbi@ti.com>

> ---
>  tools/usb/testusb.c | 4 +---
>  1 file changed, 1 insertion(+), 3 deletions(-)
> 
> diff --git a/tools/usb/testusb.c b/tools/usb/testusb.c
> index 68d0734..643cd77 100644
> --- a/tools/usb/testusb.c
> +++ b/tools/usb/testusb.c
> @@ -507,10 +507,8 @@ usage:
>  			return handle_testdev (entry) != entry;
>  		}
>  		status = pthread_create (&entry->thread, 0, handle_testdev, entry);
> -		if (status) {
> +		if (status)
>  			perror ("pthread_create");
> -			continue;
> -		}
>  	}
>  	if (device) {
>  		struct testdev		dev;
> -- 
> 1.8.0
> 

-- 
balbi

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

^ permalink raw reply	[flat|nested] 64+ messages in thread

* Re: [PATCH] mm/sparse: don't check return value of alloc_bootmem calls
  2012-12-20 20:23   ` David Rientjes
@ 2012-12-20 20:36     ` Sasha Levin
  2012-12-20 20:43       ` David Rientjes
  0 siblings, 1 reply; 64+ messages in thread
From: Sasha Levin @ 2012-12-20 20:36 UTC (permalink / raw)
  To: David Rientjes
  Cc: Andrew Morton, Johannes Weiner, Michal Hocko, Gavin Shan,
	linux-mm, linux-kernel

On 12/20/2012 03:23 PM, David Rientjes wrote:
> On Thu, 20 Dec 2012, Sasha Levin wrote:
> 
>> diff --git a/mm/sparse.c b/mm/sparse.c
>> index 6b5fb76..ae64d6e 100644
>> --- a/mm/sparse.c
>> +++ b/mm/sparse.c
>> @@ -403,15 +403,13 @@ void __init sparse_mem_maps_populate_node(struct page **map_map,
>>  	size = PAGE_ALIGN(size);
>>  	map = __alloc_bootmem_node_high(NODE_DATA(nodeid), size * map_count,
>>  					 PAGE_SIZE, __pa(MAX_DMA_ADDRESS));
>> -	if (map) {
>> -		for (pnum = pnum_begin; pnum < pnum_end; pnum++) {
>> -			if (!present_section_nr(pnum))
>> -				continue;
>> -			map_map[pnum] = map;
>> -			map += size;
>> -		}
>> -		return;
>> +	for (pnum = pnum_begin; pnum < pnum_end; pnum++) {
>> +		if (!present_section_nr(pnum))
>> +			continue;
>> +		map_map[pnum] = map;
>> +		map += size;
>>  	}
>> +	return;
>>  
>>  	/* fallback */
>>  	for (pnum = pnum_begin; pnum < pnum_end; pnum++) {
> 
> That's not true when slab_is_available() and why would you possibly add a 
> return statement right before fallback code in such cases?

So what we really need is to update the documentation of __alloc_bootmem_node, I'll send
a patch that does that instead.

I've dragged the 'return' out of the if(map) condition, I should have removed the fallback
as well and so the return would also be gone, but that's irrelevant now.


Thanks,
Sasha

^ permalink raw reply	[flat|nested] 64+ messages in thread

* Re: [PATCH] mm/sparse: don't check return value of alloc_bootmem calls
  2012-12-20 20:36     ` Sasha Levin
@ 2012-12-20 20:43       ` David Rientjes
  0 siblings, 0 replies; 64+ messages in thread
From: David Rientjes @ 2012-12-20 20:43 UTC (permalink / raw)
  To: Sasha Levin
  Cc: Andrew Morton, Johannes Weiner, Michal Hocko, Gavin Shan,
	linux-mm, linux-kernel

On Thu, 20 Dec 2012, Sasha Levin wrote:

> So what we really need is to update the documentation of __alloc_bootmem_node, I'll send
> a patch that does that instead.
> 

It panics iff slab is not available to allocate from yet, otherwise it's 
just a wrapper around kmalloc().  This emits a warning to the kernel log, 
though, so __alloc_bootmem_node() should certainly not be called that late 
in the boot sequence.

Since __alloc_bootmem_node_nopanic() is the way to avoid the panic, I 
think the change that should be made here so to panic even when the 
kmalloc() fails in __alloc_bootmem_node(), __alloc_bootmem_node_high(), 
and __alloc_bootmem_low_node().

^ permalink raw reply	[flat|nested] 64+ messages in thread

* [tip:x86/cleanups] arch/x86/platform/uv: use ARRAY_SIZE where possible
  2012-12-20 19:11 ` [PATCH] arch/x86/platform/uv: use ARRAY_SIZE where possible Sasha Levin
@ 2012-12-20 22:37   ` tip-bot for Sasha Levin
  0 siblings, 0 replies; 64+ messages in thread
From: tip-bot for Sasha Levin @ 2012-12-20 22:37 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, sasha.levin, hpa, mingo, cpw, alex.shi, tglx, hpa

Commit-ID:  6444174548f6556fcf26c84d5296defd295914c4
Gitweb:     http://git.kernel.org/tip/6444174548f6556fcf26c84d5296defd295914c4
Author:     Sasha Levin <sasha.levin@oracle.com>
AuthorDate: Thu, 20 Dec 2012 14:11:34 -0500
Committer:  H. Peter Anvin <hpa@linux.intel.com>
CommitDate: Thu, 20 Dec 2012 11:49:39 -0800

arch/x86/platform/uv: use ARRAY_SIZE where possible

Signed-off-by: Sasha Levin <sasha.levin@oracle.com>
Link: http://lkml.kernel.org/r/1356030701-16284-26-git-send-email-sasha.levin@oracle.com
Cc: Cliff Wickman <cpw@sgi.com>
Cc: Alex Shi <alex.shi@intel.com>
Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
---
 arch/x86/platform/uv/tlb_uv.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/x86/platform/uv/tlb_uv.c b/arch/x86/platform/uv/tlb_uv.c
index b8b3a37..933bea5 100644
--- a/arch/x86/platform/uv/tlb_uv.c
+++ b/arch/x86/platform/uv/tlb_uv.c
@@ -1463,7 +1463,7 @@ static ssize_t ptc_proc_write(struct file *file, const char __user *user,
 	}
 
 	if (input_arg == 0) {
-		elements = sizeof(stat_description)/sizeof(*stat_description);
+		elements = ARRAY_SIZE(stat_description);
 		printk(KERN_DEBUG "# cpu:      cpu number\n");
 		printk(KERN_DEBUG "Sender statistics:\n");
 		for (i = 0; i < elements; i++)
@@ -1504,7 +1504,7 @@ static int parse_tunables_write(struct bau_control *bcp, char *instr,
 	char *q;
 	int cnt = 0;
 	int val;
-	int e = sizeof(tunables) / sizeof(*tunables);
+	int e = ARRAY_SIZE(tunables);
 
 	p = instr + strspn(instr, WHITESPACE);
 	q = p;

^ permalink raw reply related	[flat|nested] 64+ messages in thread

* [tip:x86/cleanups] um: don't compare a pointer to 0
  2012-12-20 19:11 ` [PATCH] um: don't compare a pointer to 0 Sasha Levin
@ 2012-12-20 22:39   ` tip-bot for Sasha Levin
  0 siblings, 0 replies; 64+ messages in thread
From: tip-bot for Sasha Levin @ 2012-12-20 22:39 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, sasha.levin, hpa, mingo, richard, tglx, hpa

Commit-ID:  7be0b06520e8219e28f54cd05e1310e7e2d921ee
Gitweb:     http://git.kernel.org/tip/7be0b06520e8219e28f54cd05e1310e7e2d921ee
Author:     Sasha Levin <sasha.levin@oracle.com>
AuthorDate: Thu, 20 Dec 2012 14:11:35 -0500
Committer:  H. Peter Anvin <hpa@linux.intel.com>
CommitDate: Thu, 20 Dec 2012 11:49:39 -0800

um: don't compare a pointer to 0

Signed-off-by: Sasha Levin <sasha.levin@oracle.com>
Link: http://lkml.kernel.org/r/1356030701-16284-27-git-send-email-sasha.levin@oracle.com
Cc: Richard Weinberger <richard@nod.at>
Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
---
 arch/x86/um/fault.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/x86/um/fault.c b/arch/x86/um/fault.c
index 8784ab3..84ac7f7 100644
--- a/arch/x86/um/fault.c
+++ b/arch/x86/um/fault.c
@@ -20,7 +20,7 @@ int arch_fixup(unsigned long address, struct uml_pt_regs *regs)
 	const struct exception_table_entry *fixup;
 
 	fixup = search_exception_tables(address);
-	if (fixup != 0) {
+	if (fixup) {
 		UPT_IP(regs) = fixup->fixup;
 		return 1;
 	}

^ permalink raw reply related	[flat|nested] 64+ messages in thread

* Re: [PATCH] rcutorture: don't compare ptr with 0
  2012-12-20 19:11 ` [PATCH] rcutorture: don't compare ptr with 0 Sasha Levin
@ 2012-12-20 22:39   ` Josh Triplett
  2013-01-04 17:27     ` Paul E. McKenney
  0 siblings, 1 reply; 64+ messages in thread
From: Josh Triplett @ 2012-12-20 22:39 UTC (permalink / raw)
  To: Sasha Levin; +Cc: Paul E. McKenney, linux-kernel

On Thu, Dec 20, 2012 at 02:11:28PM -0500, Sasha Levin wrote:
> Signed-off-by: Sasha Levin <sasha.levin@oracle.com>

Fair enough.  You might as well change the first half of the conditional
too, though.  In any case:

Reviewed-by: Josh Triplett <josh@joshtriplett.org>

>  kernel/rcutorture.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/kernel/rcutorture.c b/kernel/rcutorture.c
> index 31dea01..0249800 100644
> --- a/kernel/rcutorture.c
> +++ b/kernel/rcutorture.c
> @@ -1749,7 +1749,7 @@ static int rcu_torture_barrier_init(void)
>  	barrier_cbs_wq =
>  		kzalloc(n_barrier_cbs * sizeof(barrier_cbs_wq[0]),
>  			GFP_KERNEL);
> -	if (barrier_cbs_tasks == NULL || barrier_cbs_wq == 0)
> +	if (barrier_cbs_tasks == NULL || !barrier_cbs_wq)
>  		return -ENOMEM;
>  	for (i = 0; i < n_barrier_cbs; i++) {
>  		init_waitqueue_head(&barrier_cbs_wq[i]);
> -- 
> 1.8.0
> 

^ permalink raw reply	[flat|nested] 64+ messages in thread

* [tip:x86/cleanups] x86, apb_timer: remove unused variable percpu_timer
  2012-12-20 19:11 ` [PATCH] x86, apb_timer: remove unused variable percpu_timer Sasha Levin
@ 2012-12-20 22:40   ` tip-bot for Sasha Levin
  0 siblings, 0 replies; 64+ messages in thread
From: tip-bot for Sasha Levin @ 2012-12-20 22:40 UTC (permalink / raw)
  To: linux-tip-commits; +Cc: linux-kernel, sasha.levin, hpa, mingo, tglx, hpa

Commit-ID:  8f170faeb458532282dbfa870f456e42c11d1ebb
Gitweb:     http://git.kernel.org/tip/8f170faeb458532282dbfa870f456e42c11d1ebb
Author:     Sasha Levin <sasha.levin@oracle.com>
AuthorDate: Thu, 20 Dec 2012 14:11:36 -0500
Committer:  H. Peter Anvin <hpa@linux.intel.com>
CommitDate: Thu, 20 Dec 2012 11:49:39 -0800

x86, apb_timer: remove unused variable percpu_timer

Signed-off-by: Sasha Levin <sasha.levin@oracle.com>
Link: http://lkml.kernel.org/r/1356030701-16284-28-git-send-email-sasha.levin@oracle.com
Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
---
 arch/x86/kernel/apb_timer.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/arch/x86/kernel/apb_timer.c b/arch/x86/kernel/apb_timer.c
index afdc3f75..cc74fd0 100644
--- a/arch/x86/kernel/apb_timer.c
+++ b/arch/x86/kernel/apb_timer.c
@@ -311,7 +311,6 @@ void __init apbt_time_init(void)
 #ifdef CONFIG_SMP
 	int i;
 	struct sfi_timer_table_entry *p_mtmr;
-	unsigned int percpu_timer;
 	struct apbt_dev *adev;
 #endif
 
@@ -346,13 +345,10 @@ void __init apbt_time_init(void)
 		return;
 	}
 	pr_debug("%s: %d CPUs online\n", __func__, num_online_cpus());
-	if (num_possible_cpus() <= sfi_mtimer_num) {
-		percpu_timer = 1;
+	if (num_possible_cpus() <= sfi_mtimer_num)
 		apbt_num_timers_used = num_possible_cpus();
-	} else {
-		percpu_timer = 0;
+	else
 		apbt_num_timers_used = 1;
-	}
 	pr_debug("%s: %d APB timers used\n", __func__, apbt_num_timers_used);
 
 	/* here we set up per CPU timer data structure */

^ permalink raw reply related	[flat|nested] 64+ messages in thread

* Re: [PATCH] mmc: omap_hsmmc: correct precedence of operators
  2012-12-20 19:11 ` [PATCH] mmc: omap_hsmmc: correct precedence of operators Sasha Levin
  2012-12-20 20:30   ` Felipe Balbi
@ 2012-12-20 23:04   ` Paul Walmsley
  1 sibling, 0 replies; 64+ messages in thread
From: Paul Walmsley @ 2012-12-20 23:04 UTC (permalink / raw)
  To: Sasha Levin
  Cc: Venkatraman S, t-kristo, Chris Ball, linux-mmc, linux-omap, linux-kernel

(cc Tero)

Hi,

On Thu, 20 Dec 2012, Sasha Levin wrote:

> With the current code, the condition in the if() doesn't make much sense due to
> precedence of operators.
> 
> Signed-off-by: Sasha Levin <sasha.levin@oracle.com>
> ---
>  drivers/mmc/host/omap_hsmmc.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c
> index bc58078..3ee2664 100644
> --- a/drivers/mmc/host/omap_hsmmc.c
> +++ b/drivers/mmc/host/omap_hsmmc.c
> @@ -611,7 +611,7 @@ static int omap_hsmmc_context_restore(struct omap_hsmmc_host *host)
>  	if (host->context_loss == context_loss)
>  		return 1;
>  
> -	if (!OMAP_HSMMC_READ(host->base, SYSSTATUS) & RESETDONE)
> +	if (!(OMAP_HSMMC_READ(host->base, SYSSTATUS) & RESETDONE))
>  		return 1;
>  
>  	if (host->pdata->controller_flags & OMAP_HSMMC_SUPPORTS_DUAL_VOLT) {

Makes sense to me, but I wonder if this code is even necessary after:

commit 613ad0e98c3596cd2524172fae2a795c3fc57e4a
Author: Tero Kristo <t-kristo@ti.com>
Date:   Mon Oct 29 22:02:13 2012 -0600

    ARM: OMAP: hwmod: wait for sysreset complete after enabling hwmod
    

?  You might just be able to drop those lines completely now.



- Paul

^ permalink raw reply	[flat|nested] 64+ messages in thread

* Re: [PATCH] epoll: stop comparing pointers with 0 in self-test app
  2012-12-20 19:11 ` [PATCH] epoll: stop comparing pointers with 0 in self-test app Sasha Levin
@ 2012-12-21  2:55   ` Daniel Hazelton
  0 siblings, 0 replies; 64+ messages in thread
From: Daniel Hazelton @ 2012-12-21  2:55 UTC (permalink / raw)
  To: Sasha Levin; +Cc: Andrew Morton, Paton J. Lewis, linux-kernel

I don't see anything obviously wrong here...
Reviewed-By: Daniel Hazelton <dshadowwolf@gmail.com>

On 12/20/2012 02:11 PM, Sasha Levin wrote:
> Signed-off-by: Sasha Levin <sasha.levin@oracle.com>
> ---
>   tools/testing/selftests/epoll/test_epoll.c | 4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/tools/testing/selftests/epoll/test_epoll.c b/tools/testing/selftests/epoll/test_epoll.c
> index 4a14a7f..1034ed4 100644
> --- a/tools/testing/selftests/epoll/test_epoll.c
> +++ b/tools/testing/selftests/epoll/test_epoll.c
> @@ -199,8 +199,8 @@ int main(int argc, char **argv)
>
>   	epoll_items = malloc(n_epoll_items * sizeof(struct epoll_item_private));
>
> -	if (epoll_set < 0 || epoll_items == 0 || write_thread_data.fds == 0 ||
> -		read_thread_data == 0 || read_threads == 0)
> +	if (epoll_set < 0 || !epoll_items || write_thread_data.fds == NULL ||
> +		!read_thread_data || !read_threads)
>   		goto error;
>
>   	if (sysconf(_SC_NPROCESSORS_ONLN) < 2) {
>


^ permalink raw reply	[flat|nested] 64+ messages in thread

* Re: [PATCH] virtio_console: correct error message on failure of debugfs_create_dir
  2012-12-20 19:11 ` [PATCH] virtio_console: correct error message on failure of debugfs_create_dir Sasha Levin
@ 2012-12-21  7:59   ` Amit Shah
  2012-12-24 11:55     ` Arnd Bergmann
  0 siblings, 1 reply; 64+ messages in thread
From: Amit Shah @ 2012-12-21  7:59 UTC (permalink / raw)
  To: Sasha Levin
  Cc: Arnd Bergmann, Greg Kroah-Hartman, virtualization, linux-kernel

On (Thu) 20 Dec 2012 [14:11:21], Sasha Levin wrote:
> debugfs_create_dir() returns NULL if it fails, there's little point in
> calling PTR_ERR on it.
> 
> Signed-off-by: Sasha Levin <sasha.levin@oracle.com>
> ---
>  drivers/char/virtio_console.c | 7 +++----
>  1 file changed, 3 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/char/virtio_console.c b/drivers/char/virtio_console.c
> index c594cb1..490b70e 100644
> --- a/drivers/char/virtio_console.c
> +++ b/drivers/char/virtio_console.c
> @@ -2212,10 +2212,9 @@ static int __init init(void)
>  	}
>  
>  	pdrvdata.debugfs_dir = debugfs_create_dir("virtio-ports", NULL);
> -	if (!pdrvdata.debugfs_dir) {
> -		pr_warning("Error %ld creating debugfs dir for virtio-ports\n",
> -			   PTR_ERR(pdrvdata.debugfs_dir));
> -	}
> +	if (!pdrvdata.debugfs_dir)
> +		pr_warn("Error creating debugfs dir for virtio-ports\n");

debugfs_create_dir() does return an error value if debugfs is not
enabled.

This check for !pdrvdata.debugfs_dir should infact use
IS_ERR_OR_NULL().  Care to submit a patch for that?

		Amit

^ permalink raw reply	[flat|nested] 64+ messages in thread

* Re: [PATCH] perf tools: remove redundant checks from _sort__sym_cmp
  2012-12-20 19:11 ` [PATCH] perf tools: remove redundant checks from _sort__sym_cmp Sasha Levin
@ 2012-12-21 12:55   ` Namhyung Kim
  2013-01-25 11:17   ` [tip:perf/core] " tip-bot for Sasha Levin
  1 sibling, 0 replies; 64+ messages in thread
From: Namhyung Kim @ 2012-12-21 12:55 UTC (permalink / raw)
  To: Sasha Levin
  Cc: Peter Zijlstra, Paul Mackerras, Ingo Molnar,
	Arnaldo Carvalho de Melo, Stephane Eranian, linux-kernel

On Thu, Dec 20, 2012 at 02:11:20PM -0500, Sasha Levin wrote:
> We already check that sym_l and sum_r are non-NULLs, no need to
> do it twice.
> 
> Signed-off-by: Sasha Levin <sasha.levin@oracle.com>

Acked-by: Namhyung Kim <namhyung@kernel.org>

Thanks,
Namhyung

^ permalink raw reply	[flat|nested] 64+ messages in thread

* Re: [PATCH] tools lib traceevent: remove redundant check from process_dynamic_array
  2012-12-20 19:11 ` [PATCH] tools lib traceevent: remove redundant check from process_dynamic_array Sasha Levin
@ 2012-12-21 12:58   ` Namhyung Kim
  0 siblings, 0 replies; 64+ messages in thread
From: Namhyung Kim @ 2012-12-21 12:58 UTC (permalink / raw)
  To: Sasha Levin
  Cc: Steven Rostedt, Arnaldo Carvalho de Melo, Frederic Weisbecker,
	linux-kernel

On Thu, Dec 20, 2012 at 02:11:13PM -0500, Sasha Levin wrote:
> We check twice that 'field' is non-NULL, no need to do that.
> 
> Signed-off-by: Sasha Levin <sasha.levin@oracle.com>
> ---
>  tools/lib/traceevent/event-parse.c | 5 -----
>  1 file changed, 5 deletions(-)
> 
> diff --git a/tools/lib/traceevent/event-parse.c b/tools/lib/traceevent/event-parse.c
> index 5a824e3..f7dc053 100644
> --- a/tools/lib/traceevent/event-parse.c
> +++ b/tools/lib/traceevent/event-parse.c
> @@ -2481,11 +2481,6 @@ process_dynamic_array(struct event_format *event, struct print_arg *arg, char **
>  
>  	free_token(token);
>  	arg = alloc_arg();
> -	if (!field) {

I think it should be 'if (!arg)' instead.

Thanks,
Namhyung


> -		do_warning("%s: not enough memory!", __func__);
> -		*tok = NULL;
> -		return EVENT_ERROR;
> -	}
>  
>  	type = process_arg(event, arg, &token);
>  	if (type == EVENT_ERROR)
> -- 
> 1.8.0

^ permalink raw reply	[flat|nested] 64+ messages in thread

* Re: [PATCH] cpupowerutils: don't compare pointers with 0
  2012-12-20 19:11 ` [PATCH] cpupowerutils: don't compare pointers with 0 Sasha Levin
@ 2012-12-21 21:41   ` Thomas Renninger
  0 siblings, 0 replies; 64+ messages in thread
From: Thomas Renninger @ 2012-12-21 21:41 UTC (permalink / raw)
  To: Sasha Levin; +Cc: Dominik Brodowski, linux-kernel

On Thursday, December 20, 2012 02:11:17 PM Sasha Levin wrote:
> Signed-off-by: Sasha Levin <sasha.levin@oracle.com>

Both look fine.
I'll catch them in the new year.

Thanks,

    Thomas

^ permalink raw reply	[flat|nested] 64+ messages in thread

* Re: [PATCH] kvm tools: remove unneeded checks in qcow code
  2012-12-20 19:11 ` [PATCH] kvm tools: remove unneeded checks in qcow code Sasha Levin
@ 2012-12-21 22:03   ` Jesper Juhl
  0 siblings, 0 replies; 64+ messages in thread
From: Jesper Juhl @ 2012-12-21 22:03 UTC (permalink / raw)
  To: Sasha Levin; +Cc: Pekka Enberg, Sasha Levin, Asias He, kvm, linux-kernel

On Thu, 20 Dec 2012, Sasha Levin wrote:

> We already know q!=NULL at that point, no need to retest.
> 
Right, and even if it was ==NULL then 'free(NULL)' is guaranteed to be a 
NOP, so it would still be fine.

Reviewed-by: Jesper Juhl <jj@chaosbits.net>


> Signed-off-by: Sasha Levin <sasha.levin@oracle.com>
> ---
>  tools/kvm/disk/qcow.c | 6 ++----
>  1 file changed, 2 insertions(+), 4 deletions(-)
> 
> diff --git a/tools/kvm/disk/qcow.c b/tools/kvm/disk/qcow.c
> index ee2992e..64a2550 100644
> --- a/tools/kvm/disk/qcow.c
> +++ b/tools/kvm/disk/qcow.c
> @@ -1361,8 +1361,7 @@ free_header:
>  	if (q->header)
>  		free(q->header);
>  free_qcow:
> -	if (q)
> -		free(q);
> +	free(q);
>  
>  	return NULL;
>  }
> @@ -1492,8 +1491,7 @@ free_header:
>  	if (q->header)
>  		free(q->header);
>  free_qcow:
> -	if (q)
> -		free(q);
> +	free(q);
>  
>  	return NULL;
>  }
> 

-- 
Jesper Juhl <jj@chaosbits.net>       http://www.chaosbits.net/
Don't top-post http://www.catb.org/jargon/html/T/top-post.html
Plain text mails only, please.


^ permalink raw reply	[flat|nested] 64+ messages in thread

* Re: [PATCH] bnx2x: use ARRAY_SIZE where possible
  2012-12-20 19:11 ` [PATCH] bnx2x: use ARRAY_SIZE where possible Sasha Levin
@ 2012-12-23  8:49   ` Eilon Greenstein
  2012-12-28  4:30     ` David Miller
  0 siblings, 1 reply; 64+ messages in thread
From: Eilon Greenstein @ 2012-12-23  8:49 UTC (permalink / raw)
  To: Sasha Levin; +Cc: netdev, linux-kernel

On Thu, 2012-12-20 at 14:11 -0500, Sasha Levin wrote:
> Signed-off-by: Sasha Levin <sasha.levin@oracle.com>

Hi Sasha,

I have no problem with this cosmetic change, but it should probably be
sent to net-next when it is open again. When you do resubmit it, you can
add my ACK:

Acked-by Eilon Greenstein <eilong@broadcom.com>

Thanks,
Eilon



^ permalink raw reply	[flat|nested] 64+ messages in thread

* Re: [PATCH] virtio_console: correct error message on failure of debugfs_create_dir
  2012-12-21  7:59   ` Amit Shah
@ 2012-12-24 11:55     ` Arnd Bergmann
  2012-12-24 17:39       ` Greg Kroah-Hartman
  0 siblings, 1 reply; 64+ messages in thread
From: Arnd Bergmann @ 2012-12-24 11:55 UTC (permalink / raw)
  To: Amit Shah; +Cc: Sasha Levin, Greg Kroah-Hartman, virtualization, linux-kernel

On Friday 21 December 2012, Amit Shah wrote:
> On (Thu) 20 Dec 2012 [14:11:21], Sasha Levin wrote:
> > debugfs_create_dir() returns NULL if it fails, there's little point in
> > calling PTR_ERR on it.
>
> debugfs_create_dir() does return an error value if debugfs is not
> enabled.
> 
> This check for !pdrvdata.debugfs_dir should infact use
> IS_ERR_OR_NULL().  Care to submit a patch for that?

How about we fix the stub instead to return NULL when debugfs is disabled?

	Arnd

^ permalink raw reply	[flat|nested] 64+ messages in thread

* Re: [PATCH] virtio_console: correct error message on failure of debugfs_create_dir
  2012-12-24 11:55     ` Arnd Bergmann
@ 2012-12-24 17:39       ` Greg Kroah-Hartman
  2012-12-24 18:24         ` Sasha Levin
  0 siblings, 1 reply; 64+ messages in thread
From: Greg Kroah-Hartman @ 2012-12-24 17:39 UTC (permalink / raw)
  To: Arnd Bergmann; +Cc: Amit Shah, Sasha Levin, virtualization, linux-kernel

On Mon, Dec 24, 2012 at 11:55:46AM +0000, Arnd Bergmann wrote:
> On Friday 21 December 2012, Amit Shah wrote:
> > On (Thu) 20 Dec 2012 [14:11:21], Sasha Levin wrote:
> > > debugfs_create_dir() returns NULL if it fails, there's little point in
> > > calling PTR_ERR on it.
> >
> > debugfs_create_dir() does return an error value if debugfs is not
> > enabled.
> > 
> > This check for !pdrvdata.debugfs_dir should infact use
> > IS_ERR_OR_NULL().  Care to submit a patch for that?
> 
> How about we fix the stub instead to return NULL when debugfs is disabled?

No, please read debugfs.h for why I decided to not do this (i.e. we try
to learn from our mistakes...)

thanks,

greg k-h

^ permalink raw reply	[flat|nested] 64+ messages in thread

* Re: [PATCH] virtio_console: correct error message on failure of debugfs_create_dir
  2012-12-24 17:39       ` Greg Kroah-Hartman
@ 2012-12-24 18:24         ` Sasha Levin
  2012-12-24 18:43           ` Greg Kroah-Hartman
  0 siblings, 1 reply; 64+ messages in thread
From: Sasha Levin @ 2012-12-24 18:24 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: Arnd Bergmann, Amit Shah, Sasha Levin, virtualization, linux-kernel

On Mon, Dec 24, 2012 at 12:39 PM, Greg Kroah-Hartman
<gregkh@linuxfoundation.org> wrote:
> On Mon, Dec 24, 2012 at 11:55:46AM +0000, Arnd Bergmann wrote:
>> On Friday 21 December 2012, Amit Shah wrote:
>> > On (Thu) 20 Dec 2012 [14:11:21], Sasha Levin wrote:
>> > > debugfs_create_dir() returns NULL if it fails, there's little point in
>> > > calling PTR_ERR on it.
>> >
>> > debugfs_create_dir() does return an error value if debugfs is not
>> > enabled.
>> >
>> > This check for !pdrvdata.debugfs_dir should infact use
>> > IS_ERR_OR_NULL().  Care to submit a patch for that?
>>
>> How about we fix the stub instead to return NULL when debugfs is disabled?
>
> No, please read debugfs.h for why I decided to not do this (i.e. we try
> to learn from our mistakes...)

Why won't we fix it the other way around and return an actual error
code instead of a NULL on failure?


Thanks,
Sasha

^ permalink raw reply	[flat|nested] 64+ messages in thread

* Re: [PATCH] virtio_console: correct error message on failure of debugfs_create_dir
  2012-12-24 18:24         ` Sasha Levin
@ 2012-12-24 18:43           ` Greg Kroah-Hartman
  0 siblings, 0 replies; 64+ messages in thread
From: Greg Kroah-Hartman @ 2012-12-24 18:43 UTC (permalink / raw)
  To: Sasha Levin
  Cc: Arnd Bergmann, Amit Shah, Sasha Levin, virtualization, linux-kernel

On Mon, Dec 24, 2012 at 01:24:52PM -0500, Sasha Levin wrote:
> On Mon, Dec 24, 2012 at 12:39 PM, Greg Kroah-Hartman
> <gregkh@linuxfoundation.org> wrote:
> > On Mon, Dec 24, 2012 at 11:55:46AM +0000, Arnd Bergmann wrote:
> >> On Friday 21 December 2012, Amit Shah wrote:
> >> > On (Thu) 20 Dec 2012 [14:11:21], Sasha Levin wrote:
> >> > > debugfs_create_dir() returns NULL if it fails, there's little point in
> >> > > calling PTR_ERR on it.
> >> >
> >> > debugfs_create_dir() does return an error value if debugfs is not
> >> > enabled.
> >> >
> >> > This check for !pdrvdata.debugfs_dir should infact use
> >> > IS_ERR_OR_NULL().  Care to submit a patch for that?
> >>
> >> How about we fix the stub instead to return NULL when debugfs is disabled?
> >
> > No, please read debugfs.h for why I decided to not do this (i.e. we try
> > to learn from our mistakes...)
> 
> Why won't we fix it the other way around and return an actual error
> code instead of a NULL on failure?

Again, no, that doesn't make your code simpler/faster.  You really don't
need to check the return value of debugfs, just handle it as if it
always works, and look, the code handles it all properly, no matter if
debugfs is enabled or not.  It's only debugging code, you shouldn't
really care if it is present or not, right?

If you do, perhaps you shouldn't be using debugfs?

greg k-h

^ permalink raw reply	[flat|nested] 64+ messages in thread

* Re: [PATCH] bnx2x: use ARRAY_SIZE where possible
  2012-12-23  8:49   ` Eilon Greenstein
@ 2012-12-28  4:30     ` David Miller
  0 siblings, 0 replies; 64+ messages in thread
From: David Miller @ 2012-12-28  4:30 UTC (permalink / raw)
  To: eilong; +Cc: sasha.levin, netdev, linux-kernel

From: "Eilon Greenstein" <eilong@broadcom.com>
Date: Sun, 23 Dec 2012 10:49:27 +0200

> On Thu, 2012-12-20 at 14:11 -0500, Sasha Levin wrote:
>> Signed-off-by: Sasha Levin <sasha.levin@oracle.com>
> 
> Acked-by Eilon Greenstein <eilong@broadcom.com>

Applied.

^ permalink raw reply	[flat|nested] 64+ messages in thread

* Re: [PATCH] rcutorture: don't compare ptr with 0
  2012-12-20 22:39   ` Josh Triplett
@ 2013-01-04 17:27     ` Paul E. McKenney
  0 siblings, 0 replies; 64+ messages in thread
From: Paul E. McKenney @ 2013-01-04 17:27 UTC (permalink / raw)
  To: Josh Triplett; +Cc: Sasha Levin, linux-kernel

On Thu, Dec 20, 2012 at 02:39:12PM -0800, Josh Triplett wrote:
> On Thu, Dec 20, 2012 at 02:11:28PM -0500, Sasha Levin wrote:
> > Signed-off-by: Sasha Levin <sasha.levin@oracle.com>
> 
> Fair enough.  You might as well change the first half of the conditional
> too, though.  In any case:
> 
> Reviewed-by: Josh Triplett <josh@joshtriplett.org>

Queued, thank you both!

							Thanx, Paul

> >  kernel/rcutorture.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/kernel/rcutorture.c b/kernel/rcutorture.c
> > index 31dea01..0249800 100644
> > --- a/kernel/rcutorture.c
> > +++ b/kernel/rcutorture.c
> > @@ -1749,7 +1749,7 @@ static int rcu_torture_barrier_init(void)
> >  	barrier_cbs_wq =
> >  		kzalloc(n_barrier_cbs * sizeof(barrier_cbs_wq[0]),
> >  			GFP_KERNEL);
> > -	if (barrier_cbs_tasks == NULL || barrier_cbs_wq == 0)
> > +	if (barrier_cbs_tasks == NULL || !barrier_cbs_wq)
> >  		return -ENOMEM;
> >  	for (i = 0; i < n_barrier_cbs; i++) {
> >  		init_waitqueue_head(&barrier_cbs_wq[i]);
> > -- 
> > 1.8.0
> > 
> 


^ permalink raw reply	[flat|nested] 64+ messages in thread

* Re: [PATCH] PCI: cpqphp: minor cleanup and removal of unreachable paths
  2012-12-20 19:11 ` [PATCH] PCI: cpqphp: minor cleanup and removal of unreachable paths Sasha Levin
@ 2013-01-07 18:48   ` Bjorn Helgaas
  0 siblings, 0 replies; 64+ messages in thread
From: Bjorn Helgaas @ 2013-01-07 18:48 UTC (permalink / raw)
  To: Sasha Levin; +Cc: Alan Cox, linux-pci, linux-kernel

On Thu, Dec 20, 2012 at 12:11 PM, Sasha Levin <sasha.levin@oracle.com> wrote:
> Remove cases of redundant checks and remote unreachable paths.
>
> Signed-off-by: Sasha Levin <sasha.levin@oracle.com>

Thanks, Sasha.  I applied this for v3.9.

> ---
>  drivers/pci/hotplug/cpqphp_ctrl.c | 57 ++++++++++++++-------------------------
>  1 file changed, 20 insertions(+), 37 deletions(-)
>
> diff --git a/drivers/pci/hotplug/cpqphp_ctrl.c b/drivers/pci/hotplug/cpqphp_ctrl.c
> index 36112fe..d282019 100644
> --- a/drivers/pci/hotplug/cpqphp_ctrl.c
> +++ b/drivers/pci/hotplug/cpqphp_ctrl.c
> @@ -1900,8 +1900,7 @@ static void interrupt_event_handler(struct controller *ctrl)
>                                         dbg("power fault\n");
>                                 } else {
>                                         /* refresh notification */
> -                                       if (p_slot)
> -                                               update_slot_info(ctrl, p_slot);
> +                                       update_slot_info(ctrl, p_slot);
>                                 }
>
>                                 ctrl->event_queue[loop].event_type = 0;
> @@ -2520,44 +2519,28 @@ static int configure_new_function(struct controller *ctrl, struct pci_func *func
>
>                 /* If we have IO resources copy them and fill in the bridge's
>                  * IO range registers */
> -               if (io_node) {
> -                       memcpy(hold_IO_node, io_node, sizeof(struct pci_resource));
> -                       io_node->next = NULL;
> +               memcpy(hold_IO_node, io_node, sizeof(struct pci_resource));
> +               io_node->next = NULL;
>
> -                       /* set IO base and Limit registers */
> -                       temp_byte = io_node->base >> 8;
> -                       rc = pci_bus_write_config_byte(pci_bus, devfn, PCI_IO_BASE, temp_byte);
> +               /* set IO base and Limit registers */
> +               temp_byte = io_node->base >> 8;
> +               rc = pci_bus_write_config_byte(pci_bus, devfn, PCI_IO_BASE, temp_byte);
>
> -                       temp_byte = (io_node->base + io_node->length - 1) >> 8;
> -                       rc = pci_bus_write_config_byte(pci_bus, devfn, PCI_IO_LIMIT, temp_byte);
> -               } else {
> -                       kfree(hold_IO_node);
> -                       hold_IO_node = NULL;
> -               }
> -
> -               /* If we have memory resources copy them and fill in the
> -                * bridge's memory range registers.  Otherwise, fill in the
> -                * range registers with values that disable them. */
> -               if (mem_node) {
> -                       memcpy(hold_mem_node, mem_node, sizeof(struct pci_resource));
> -                       mem_node->next = NULL;
> -
> -                       /* set Mem base and Limit registers */
> -                       temp_word = mem_node->base >> 16;
> -                       rc = pci_bus_write_config_word(pci_bus, devfn, PCI_MEMORY_BASE, temp_word);
> +               temp_byte = (io_node->base + io_node->length - 1) >> 8;
> +               rc = pci_bus_write_config_byte(pci_bus, devfn, PCI_IO_LIMIT, temp_byte);
>
> -                       temp_word = (mem_node->base + mem_node->length - 1) >> 16;
> -                       rc = pci_bus_write_config_word(pci_bus, devfn, PCI_MEMORY_LIMIT, temp_word);
> -               } else {
> -                       temp_word = 0xFFFF;
> -                       rc = pci_bus_write_config_word(pci_bus, devfn, PCI_MEMORY_BASE, temp_word);
> +               /* Copy the memory resources and fill in the bridge's memory
> +                * range registers.
> +                */
> +               memcpy(hold_mem_node, mem_node, sizeof(struct pci_resource));
> +               mem_node->next = NULL;
>
> -                       temp_word = 0x0000;
> -                       rc = pci_bus_write_config_word(pci_bus, devfn, PCI_MEMORY_LIMIT, temp_word);
> +               /* set Mem base and Limit registers */
> +               temp_word = mem_node->base >> 16;
> +               rc = pci_bus_write_config_word(pci_bus, devfn, PCI_MEMORY_BASE, temp_word);
>
> -                       kfree(hold_mem_node);
> -                       hold_mem_node = NULL;
> -               }
> +               temp_word = (mem_node->base + mem_node->length - 1) >> 16;
> +               rc = pci_bus_write_config_word(pci_bus, devfn, PCI_MEMORY_LIMIT, temp_word);
>
>                 memcpy(hold_p_mem_node, p_mem_node, sizeof(struct pci_resource));
>                 p_mem_node->next = NULL;
> @@ -2627,7 +2610,7 @@ static int configure_new_function(struct controller *ctrl, struct pci_func *func
>                 /* Return unused bus resources
>                  * First use the temporary node to store information for
>                  * the board */
> -               if (hold_bus_node && bus_node && temp_resources.bus_head) {
> +               if (bus_node && temp_resources.bus_head) {
>                         hold_bus_node->length = bus_node->base - hold_bus_node->base;
>
>                         hold_bus_node->next = func->bus_head;
> @@ -2751,7 +2734,7 @@ static int configure_new_function(struct controller *ctrl, struct pci_func *func
>                 }
>                 /* If we have prefetchable memory space available and there
>                  * is some left at the end, return the unused portion */
> -               if (hold_p_mem_node && temp_resources.p_mem_head) {
> +               if (temp_resources.p_mem_head) {
>                         p_mem_node = do_pre_bridge_resource_split(&(temp_resources.p_mem_head),
>                                                                   &hold_p_mem_node, 0x100000);
>
> --
> 1.8.0
>

^ permalink raw reply	[flat|nested] 64+ messages in thread

* [tip:perf/core] perf tools: remove redundant checks from _sort__sym_cmp
  2012-12-20 19:11 ` [PATCH] perf tools: remove redundant checks from _sort__sym_cmp Sasha Levin
  2012-12-21 12:55   ` Namhyung Kim
@ 2013-01-25 11:17   ` tip-bot for Sasha Levin
  1 sibling, 0 replies; 64+ messages in thread
From: tip-bot for Sasha Levin @ 2013-01-25 11:17 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: acme, linux-kernel, eranian, paulus, mingo, sasha.levin, hpa,
	mingo, a.p.zijlstra, namhyung, tglx

Commit-ID:  53985a7bfa7b947c91f35c6adcdc9cacc6fef07f
Gitweb:     http://git.kernel.org/tip/53985a7bfa7b947c91f35c6adcdc9cacc6fef07f
Author:     Sasha Levin <sasha.levin@oracle.com>
AuthorDate: Thu, 20 Dec 2012 14:11:20 -0500
Committer:  Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Thu, 24 Jan 2013 16:40:14 -0300

perf tools: remove redundant checks from _sort__sym_cmp

We already check that sym_l and sum_r are non-NULLs, no need to do it
twice.

Signed-off-by: Sasha Levin <sasha.levin@oracle.com>
Acked-by: Namhyung Kim <namhyung@kernel.org>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Stephane Eranian <eranian@google.com>
Link: http://lkml.kernel.org/r/1356030701-16284-12-git-send-email-sasha.levin@oracle.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/util/sort.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/tools/perf/util/sort.c b/tools/perf/util/sort.c
index cfd1c0f..dbaded9 100644
--- a/tools/perf/util/sort.c
+++ b/tools/perf/util/sort.c
@@ -143,10 +143,8 @@ static int64_t _sort__sym_cmp(struct symbol *sym_l, struct symbol *sym_r,
 	if (sym_l == sym_r)
 		return 0;
 
-	if (sym_l)
-		ip_l = sym_l->start;
-	if (sym_r)
-		ip_r = sym_r->start;
+	ip_l = sym_l->start;
+	ip_r = sym_r->start;
 
 	return (int64_t)(ip_r - ip_l);
 }

^ permalink raw reply related	[flat|nested] 64+ messages in thread

* [tip:perf/core] perf kmem: use ARRAY_SIZE instead of reinventing it
  2012-12-20 19:11 ` [PATCH] perf kmem: use ARRAY_SIZE instead of reinventing it Sasha Levin
@ 2013-01-25 11:19   ` tip-bot for Sasha Levin
  0 siblings, 0 replies; 64+ messages in thread
From: tip-bot for Sasha Levin @ 2013-01-25 11:19 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: acme, linux-kernel, paulus, mingo, sasha.levin, hpa, mingo,
	a.p.zijlstra, tglx

Commit-ID:  49e4ba54592435cbd150aea8f5ae6b776fc687f9
Gitweb:     http://git.kernel.org/tip/49e4ba54592435cbd150aea8f5ae6b776fc687f9
Author:     Sasha Levin <sasha.levin@oracle.com>
AuthorDate: Thu, 20 Dec 2012 14:11:16 -0500
Committer:  Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Thu, 24 Jan 2013 16:40:15 -0300

perf kmem: use ARRAY_SIZE instead of reinventing it

Signed-off-by: Sasha Levin <sasha.levin@oracle.com>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Link: http://lkml.kernel.org/r/1356030701-16284-8-git-send-email-sasha.levin@oracle.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/builtin-kmem.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/tools/perf/builtin-kmem.c b/tools/perf/builtin-kmem.c
index 9fddca7..c746108 100644
--- a/tools/perf/builtin-kmem.c
+++ b/tools/perf/builtin-kmem.c
@@ -609,8 +609,7 @@ static struct sort_dimension *avail_sorts[] = {
 	&pingpong_sort_dimension,
 };
 
-#define NUM_AVAIL_SORTS	\
-	(int)(sizeof(avail_sorts) / sizeof(struct sort_dimension *))
+#define NUM_AVAIL_SORTS	((int)ARRAY_SIZE(avail_sorts))
 
 static int sort_dimension__add(const char *tok, struct list_head *list)
 {

^ permalink raw reply related	[flat|nested] 64+ messages in thread

* [tip:perf/core] perf script: use ARRAY_SIZE instead of reinventing it
  2012-12-20 19:11 ` [PATCH] perf script: use ARRAY_SIZE instead of reinventing it Sasha Levin
@ 2013-01-25 11:20   ` tip-bot for Sasha Levin
  0 siblings, 0 replies; 64+ messages in thread
From: tip-bot for Sasha Levin @ 2013-01-25 11:20 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: acme, linux-kernel, paulus, mingo, sasha.levin, hpa, mingo,
	a.p.zijlstra, tglx

Commit-ID:  50ca19aed8ad2e264ef6bce6d6d5cb7f8bfae8c9
Gitweb:     http://git.kernel.org/tip/50ca19aed8ad2e264ef6bce6d6d5cb7f8bfae8c9
Author:     Sasha Levin <sasha.levin@oracle.com>
AuthorDate: Thu, 20 Dec 2012 14:11:19 -0500
Committer:  Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Thu, 24 Jan 2013 16:40:15 -0300

perf script: use ARRAY_SIZE instead of reinventing it

Signed-off-by: Sasha Levin <sasha.levin@oracle.com>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Link: http://lkml.kernel.org/r/1356030701-16284-11-git-send-email-sasha.levin@oracle.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/builtin-script.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/perf/builtin-script.c b/tools/perf/builtin-script.c
index b363e7b..3314ef2 100644
--- a/tools/perf/builtin-script.c
+++ b/tools/perf/builtin-script.c
@@ -692,7 +692,7 @@ static int parse_output_fields(const struct option *opt __maybe_unused,
 			    const char *arg, int unset __maybe_unused)
 {
 	char *tok;
-	int i, imax = sizeof(all_output_options) / sizeof(struct output_option);
+	int i, imax = ARRAY_SIZE(all_output_options);
 	int j;
 	int rc = 0;
 	char *str = strdup(arg);

^ permalink raw reply related	[flat|nested] 64+ messages in thread

* [tip:perf/core] uprobes: remove redundant check
  2012-12-20 19:11 ` [PATCH] uprobes: remove redundant check Sasha Levin
@ 2013-01-25 11:21   ` tip-bot for Sasha Levin
  0 siblings, 0 replies; 64+ messages in thread
From: tip-bot for Sasha Levin @ 2013-01-25 11:21 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: acme, linux-kernel, paulus, mingo, sasha.levin, hpa, mingo,
	a.p.zijlstra, tglx

Commit-ID:  c91368c4889a0ee5dd06552adbb50ae54f5096fd
Gitweb:     http://git.kernel.org/tip/c91368c4889a0ee5dd06552adbb50ae54f5096fd
Author:     Sasha Levin <sasha.levin@oracle.com>
AuthorDate: Thu, 20 Dec 2012 14:11:30 -0500
Committer:  Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Thu, 24 Jan 2013 16:40:15 -0300

uprobes: remove redundant check

We checked for uprobe==NULL earlier, no need to redo that.

Signed-off-by: Sasha Levin <sasha.levin@oracle.com>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Link: http://lkml.kernel.org/r/1356030701-16284-22-git-send-email-sasha.levin@oracle.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 kernel/events/uprobes.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/kernel/events/uprobes.c b/kernel/events/uprobes.c
index dea7acf..30ea9a4 100644
--- a/kernel/events/uprobes.c
+++ b/kernel/events/uprobes.c
@@ -901,8 +901,7 @@ void uprobe_unregister(struct inode *inode, loff_t offset, struct uprobe_consume
 	}
 
 	mutex_unlock(uprobes_hash(inode));
-	if (uprobe)
-		put_uprobe(uprobe);
+	put_uprobe(uprobe);
 }
 
 static struct rb_node *

^ permalink raw reply related	[flat|nested] 64+ messages in thread

end of thread, other threads:[~2013-01-25 11:21 UTC | newest]

Thread overview: 64+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-12-20 19:11 [PATCH] tools, power: correct precedence of operators in init_maxfreq_mode Sasha Levin
2012-12-20 19:11 ` [PATCH] kvm tools: remove unneeded checks in qcow code Sasha Levin
2012-12-21 22:03   ` Jesper Juhl
2012-12-20 19:11 ` [PATCH] kvm tools: remove unneeded check from disk code Sasha Levin
2012-12-20 19:11 ` [PATCH] kvm tools: correctly compare pointer with NULL instead of 0 Sasha Levin
2012-12-20 19:11 ` [PATCH] tools lib traceevent: remove redundant check from process_dynamic_array Sasha Levin
2012-12-21 12:58   ` Namhyung Kim
2012-12-20 19:11 ` [PATCH] epoll: stop comparing pointers with 0 in self-test app Sasha Levin
2012-12-21  2:55   ` Daniel Hazelton
2012-12-20 19:11 ` [PATCH] tools/usb: remove unneeded 'continue' and simplify condition Sasha Levin
2012-12-20 20:32   ` Felipe Balbi
2012-12-20 19:11 ` [PATCH] perf kmem: use ARRAY_SIZE instead of reinventing it Sasha Levin
2013-01-25 11:19   ` [tip:perf/core] " tip-bot for Sasha Levin
2012-12-20 19:11 ` [PATCH] cpupowerutils: don't compare pointers with 0 Sasha Levin
2012-12-21 21:41   ` Thomas Renninger
2012-12-20 19:11 ` [PATCH] m2m-deinterlace: use correct check for kzalloc failure Sasha Levin
2012-12-20 19:11 ` [PATCH] perf script: use ARRAY_SIZE instead of reinventing it Sasha Levin
2013-01-25 11:20   ` [tip:perf/core] " tip-bot for Sasha Levin
2012-12-20 19:11 ` [PATCH] perf tools: remove redundant checks from _sort__sym_cmp Sasha Levin
2012-12-21 12:55   ` Namhyung Kim
2013-01-25 11:17   ` [tip:perf/core] " tip-bot for Sasha Levin
2012-12-20 19:11 ` [PATCH] virtio_console: correct error message on failure of debugfs_create_dir Sasha Levin
2012-12-21  7:59   ` Amit Shah
2012-12-24 11:55     ` Arnd Bergmann
2012-12-24 17:39       ` Greg Kroah-Hartman
2012-12-24 18:24         ` Sasha Levin
2012-12-24 18:43           ` Greg Kroah-Hartman
2012-12-20 19:11 ` [PATCH] debugfs: remove redundant initialization of dentry Sasha Levin
2012-12-20 19:11 ` [PATCH] PCI: cpqphp: minor cleanup and removal of unreachable paths Sasha Levin
2013-01-07 18:48   ` Bjorn Helgaas
2012-12-20 19:11 ` [PATCH] bnx2x: use ARRAY_SIZE where possible Sasha Levin
2012-12-23  8:49   ` Eilon Greenstein
2012-12-28  4:30     ` David Miller
2012-12-20 19:11 ` [PATCH] wireless: mwifiex: remove unreachable paths Sasha Levin
2012-12-20 20:13   ` Bing Zhao
2012-12-20 19:11 ` [PATCH] mmc: omap_hsmmc: correct precedence of operators Sasha Levin
2012-12-20 20:30   ` Felipe Balbi
2012-12-20 23:04   ` Paul Walmsley
2012-12-20 19:11 ` [PATCH] kdb: use ARRAY_SIZE where possible Sasha Levin
2012-12-20 19:11 ` [PATCH] rcutorture: don't compare ptr with 0 Sasha Levin
2012-12-20 22:39   ` Josh Triplett
2013-01-04 17:27     ` Paul E. McKenney
2012-12-20 19:11 ` [PATCH] sched: fair: simplify can_migrate_task a bit Sasha Levin
2012-12-20 19:11 ` [PATCH] uprobes: remove redundant check Sasha Levin
2013-01-25 11:21   ` [tip:perf/core] " tip-bot for Sasha Levin
2012-12-20 19:11 ` [PATCH] cgroup: " Sasha Levin
2012-12-20 19:18   ` Tejun Heo
2012-12-20 19:24     ` Sasha Levin
2012-12-20 19:11 ` [PATCH] mm: memory_hotplug: no need to check res twice in add_memory Sasha Levin
2012-12-20 19:11 ` [PATCH] x86, efi: correct precedence of operators in setup_efi_pci Sasha Levin
2012-12-20 19:59   ` [tip:x86/urgent] " tip-bot for Sasha Levin
2012-12-20 19:11 ` [PATCH] arch/x86/platform/uv: use ARRAY_SIZE where possible Sasha Levin
2012-12-20 22:37   ` [tip:x86/cleanups] " tip-bot for Sasha Levin
2012-12-20 19:11 ` [PATCH] um: don't compare a pointer to 0 Sasha Levin
2012-12-20 22:39   ` [tip:x86/cleanups] " tip-bot for Sasha Levin
2012-12-20 19:11 ` [PATCH] x86, apb_timer: remove unused variable percpu_timer Sasha Levin
2012-12-20 22:40   ` [tip:x86/cleanups] " tip-bot for Sasha Levin
2012-12-20 19:11 ` [PATCH] kdb: use DIV_ROUND_UP where possible Sasha Levin
2012-12-20 19:11 ` [PATCH] mm/sparse: don't check return value of alloc_bootmem calls Sasha Levin
2012-12-20 20:23   ` David Rientjes
2012-12-20 20:36     ` Sasha Levin
2012-12-20 20:43       ` David Rientjes
2012-12-20 19:11 ` [PATCH] slob: use DIV_ROUND_UP where possible Sasha Levin
2012-12-20 19:40   ` Christoph Lameter

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).