diff mbox

[v3,3/7] block/sheepdog: remove spurious NULL check

Message ID fa437e7bf3f9d825544d3833f779b417ba1f39a3.1510093478.git.jcody@redhat.com (mailing list archive)
State New, archived
Headers show

Commit Message

Jeff Cody Nov. 7, 2017, 10:27 p.m. UTC
'tag' is already checked in the lines immediately preceding this check,
and set to non-NULL if NULL.  No need to check again, it hasn't changed.

Signed-off-by: Jeff Cody <jcody@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
---
 block/sheepdog.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Darren Kenny Nov. 8, 2017, 10:48 a.m. UTC | #1
On Tue, Nov 07, 2017 at 05:27:20PM -0500, Jeff Cody wrote:
>'tag' is already checked in the lines immediately preceding this check,
>and set to non-NULL if NULL.  No need to check again, it hasn't changed.
>
>Signed-off-by: Jeff Cody <jcody@redhat.com>
>Reviewed-by: Eric Blake <eblake@redhat.com>

Reviewed-by: Darren Kenny <darren.kenny@oracle.com>

>---
> block/sheepdog.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
>diff --git a/block/sheepdog.c b/block/sheepdog.c
>index 696a714..459d93a 100644
>--- a/block/sheepdog.c
>+++ b/block/sheepdog.c
>@@ -1632,7 +1632,7 @@ static int sd_open(BlockDriverState *bs, QDict *options, int flags,
>     if (!tag) {
>         tag = "";
>     }
>-    if (tag && strlen(tag) >= SD_MAX_VDI_TAG_LEN) {
>+    if (strlen(tag) >= SD_MAX_VDI_TAG_LEN) {
>         error_setg(errp, "value of parameter 'tag' is too long");
>         ret = -EINVAL;
>         goto err_no_fd;
>-- 
>2.9.5
>
>
diff mbox

Patch

diff --git a/block/sheepdog.c b/block/sheepdog.c
index 696a714..459d93a 100644
--- a/block/sheepdog.c
+++ b/block/sheepdog.c
@@ -1632,7 +1632,7 @@  static int sd_open(BlockDriverState *bs, QDict *options, int flags,
     if (!tag) {
         tag = "";
     }
-    if (tag && strlen(tag) >= SD_MAX_VDI_TAG_LEN) {
+    if (strlen(tag) >= SD_MAX_VDI_TAG_LEN) {
         error_setg(errp, "value of parameter 'tag' is too long");
         ret = -EINVAL;
         goto err_no_fd;