1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-12-21 13:34:40 +03:00

cleanup: drop unused value assign

Dop unused value assignments.

Unknown is detected via other combination
(!linear && !striped).

Also change the log_error() message into a warning,
since the function is not really returning error,
but still keep the INTERNAL_ERROR.

Ret value is always set later.
This commit is contained in:
Zdenek Kabelac 2015-02-19 14:03:45 +01:00
parent ed420fb691
commit 4c184e9d6b
6 changed files with 12 additions and 15 deletions

View File

@ -332,16 +332,15 @@ static int _has_partition_table(struct device *dev)
#ifdef UDEV_SYNC_SUPPORT
static int _udev_dev_is_partitioned(struct device *dev)
{
const char *value;
struct dev_ext *ext;
if (!(ext = dev_ext_get(dev)))
return_0;
if (!(value = udev_device_get_property_value((struct udev_device *)ext->handle, DEV_EXT_UDEV_BLKID_PART_TABLE_TYPE)))
if (!udev_device_get_property_value((struct udev_device *)ext->handle, DEV_EXT_UDEV_BLKID_PART_TABLE_TYPE))
return 0;
if ((value = udev_device_get_property_value((struct udev_device *)ext->handle, DEV_EXT_UDEV_BLKID_PART_ENTRY_DISK)))
if (udev_device_get_property_value((struct udev_device *)ext->handle, DEV_EXT_UDEV_BLKID_PART_ENTRY_DISK))
return 0;
return 1;

View File

@ -452,7 +452,7 @@ bad:
int lv_layout_and_role(struct dm_pool *mem, const struct logical_volume *lv,
struct dm_list **layout, struct dm_list **role) {
int linear, striped, unknown;
int linear, striped;
struct lv_segment *seg;
int public_lv = 1;
@ -505,7 +505,7 @@ int lv_layout_and_role(struct dm_pool *mem, const struct logical_volume *lv,
* linear or striped or mixture of these two.
*/
if (dm_list_empty(*layout)) {
linear = striped = unknown = 0;
linear = striped = 0;
dm_list_iterate_items(seg, &lv->segments) {
if (seg_is_linear(seg))
linear = 1;
@ -519,9 +519,8 @@ int lv_layout_and_role(struct dm_pool *mem, const struct logical_volume *lv,
* the role above and we need add proper
* detection for such role!
*/
unknown = 1;
log_error(INTERNAL_ERROR "Failed to properly detect "
"layout and role for LV %s/%s",
log_warn(INTERNAL_ERROR "WARNING: Failed to properly detect "
"layout and role for LV %s/%s.",
lv->vg->name, lv->name);
}
}

View File

@ -522,7 +522,7 @@ static struct dm_config_node *_section(struct parser *p, struct dm_config_node *
{
/* IDENTIFIER SECTION_B_CHAR VALUE* SECTION_E_CHAR */
struct dm_config_node *root, *n;
struct dm_config_node *root;
struct dm_config_value *value;
char *str;
@ -555,7 +555,7 @@ static struct dm_config_node *_section(struct parser *p, struct dm_config_node *
if (p->t == TOK_SECTION_B) {
match(TOK_SECTION_B);
while (p->t != TOK_SECTION_E) {
if (!(n = _section(p, root)))
if (!(_section(p, root)))
return_NULL;
}
match(TOK_SECTION_E);

View File

@ -3538,7 +3538,7 @@ static int _lvconvert_merge_single(struct cmd_context *cmd, struct logical_volum
int lvconvert(struct cmd_context * cmd, int argc, char **argv)
{
int ret = ECMD_PROCESSED;
int ret;
struct lvconvert_params lp = {
.target_attr = ~0,
};

View File

@ -160,8 +160,7 @@ int pvchange(struct cmd_context *cmd, int argc, char **argv)
{
struct pvchange_params params = { 0 };
struct processing_handle *handle = NULL;
int ret = ECMD_PROCESSED;
int ret;
if (!(arg_count(cmd, allocatable_ARG) + arg_is_set(cmd, addtag_ARG) +
arg_is_set(cmd, deltag_ARG) + arg_count(cmd, uuid_ARG) +

View File

@ -48,7 +48,7 @@ int pvresize(struct cmd_context *cmd, int argc, char **argv)
{
struct pvresize_params params;
struct processing_handle *handle = NULL;
int ret = ECMD_PROCESSED;
int ret;
if (!argc) {
log_error("Please supply physical volume(s)");