xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] gnttab: remove pointless NULL check
@ 2012-04-17 12:34 Jan Beulich
  2012-04-17 12:45 ` Keir Fraser
  0 siblings, 1 reply; 2+ messages in thread
From: Jan Beulich @ 2012-04-17 12:34 UTC (permalink / raw)
  To: xen-devel

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

Domains in the domain hash (and hence locatable via the usual lookup
functions) can't have a NULL grant table pointer; no other function
performs such a check, so remove it from gnttab_prepare_for_transfer()
for consistency.

Signed-off-by: Jan Beulich <jbeulich@suse.com>

--- a/xen/common/grant_table.c
+++ b/xen/common/grant_table.c
@@ -1390,17 +1390,11 @@ static int 
 gnttab_prepare_for_transfer(
     struct domain *rd, struct domain *ld, grant_ref_t ref)
 {
-    struct grant_table *rgt;
+    struct grant_table *rgt = rd->grant_table;
     grant_entry_header_t *sha;
     union grant_combo   scombo, prev_scombo, new_scombo;
     int                 retries = 0;
 
-    if ( unlikely((rgt = rd->grant_table) == NULL) )
-    {
-        gdprintk(XENLOG_INFO, "Dom %d has no grant table.\n", rd->domain_id);
-        return 0;
-    }
-
     spin_lock(&rgt->lock);
 
     if ( rgt->gt_version == 0 )




[-- Attachment #2: gnttab-pointless-check.patch --]
[-- Type: text/plain, Size: 971 bytes --]

gnttab: remove pointless NULL check

Domains in the domain hash (and hence locatable via the usual lookup
functions) can't have a NULL grant table pointer; no other function
performs such a check, so remove it from gnttab_prepare_for_transfer()
for consistency.

Signed-off-by: Jan Beulich <jbeulich@suse.com>

--- a/xen/common/grant_table.c
+++ b/xen/common/grant_table.c
@@ -1390,17 +1390,11 @@ static int 
 gnttab_prepare_for_transfer(
     struct domain *rd, struct domain *ld, grant_ref_t ref)
 {
-    struct grant_table *rgt;
+    struct grant_table *rgt = rd->grant_table;
     grant_entry_header_t *sha;
     union grant_combo   scombo, prev_scombo, new_scombo;
     int                 retries = 0;
 
-    if ( unlikely((rgt = rd->grant_table) == NULL) )
-    {
-        gdprintk(XENLOG_INFO, "Dom %d has no grant table.\n", rd->domain_id);
-        return 0;
-    }
-
     spin_lock(&rgt->lock);
 
     if ( rgt->gt_version == 0 )

[-- Attachment #3: Type: text/plain, Size: 126 bytes --]

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel

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

* Re: [PATCH] gnttab: remove pointless NULL check
  2012-04-17 12:34 [PATCH] gnttab: remove pointless NULL check Jan Beulich
@ 2012-04-17 12:45 ` Keir Fraser
  0 siblings, 0 replies; 2+ messages in thread
From: Keir Fraser @ 2012-04-17 12:45 UTC (permalink / raw)
  To: Jan Beulich, xen-devel

On 17/04/2012 13:34, "Jan Beulich" <JBeulich@suse.com> wrote:

> Domains in the domain hash (and hence locatable via the usual lookup
> functions) can't have a NULL grant table pointer; no other function
> performs such a check, so remove it from gnttab_prepare_for_transfer()
> for consistency.
> 
> Signed-off-by: Jan Beulich <jbeulich@suse.com>

Acked-by: Keir Fraser <keir@xen.org>

> --- a/xen/common/grant_table.c
> +++ b/xen/common/grant_table.c
> @@ -1390,17 +1390,11 @@ static int
>  gnttab_prepare_for_transfer(
>      struct domain *rd, struct domain *ld, grant_ref_t ref)
>  {
> -    struct grant_table *rgt;
> +    struct grant_table *rgt = rd->grant_table;
>      grant_entry_header_t *sha;
>      union grant_combo   scombo, prev_scombo, new_scombo;
>      int                 retries = 0;
>  
> -    if ( unlikely((rgt = rd->grant_table) == NULL) )
> -    {
> -        gdprintk(XENLOG_INFO, "Dom %d has no grant table.\n", rd->domain_id);
> -        return 0;
> -    }
> -
>      spin_lock(&rgt->lock);
>  
>      if ( rgt->gt_version == 0 )
> 
> 
> 
> _______________________________________________
> Xen-devel mailing list
> Xen-devel@lists.xen.org
> http://lists.xen.org/xen-devel

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

end of thread, other threads:[~2012-04-17 12:45 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-04-17 12:34 [PATCH] gnttab: remove pointless NULL check Jan Beulich
2012-04-17 12:45 ` Keir Fraser

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).