Skip to content

Commit

Permalink
UBI: silence a warning
Browse files Browse the repository at this point in the history
This patch silences the following warning :

  drivers/mtd/ubi/vmt.c:73: warning: 'ret' may be used uninitialized in this function

gcc can't see that we always initialize ret in all situations where it is
actually used. The one case where it's not initialized is when we BUG(),
but gcc doesn't know that we won't then continue and use an uninitialized
'ret'.

This patch results in code that does exactely the same as before, but it
also makes gcc shut up, so we generate one less line of warning noise.

Signed-off-by: Jesper Juhl <jesper.juhl@gmail.com>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
  • Loading branch information
Jesper Juhl authored and Artem Bityutskiy committed Dec 26, 2007
1 parent 393852e commit 54b2c8f
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions drivers/mtd/ubi/vmt.c
Original file line number Diff line number Diff line change
Expand Up @@ -70,13 +70,14 @@ static struct device_attribute attr_vol_upd_marker =
static ssize_t vol_attribute_show(struct device *dev,
struct device_attribute *attr, char *buf)
{
int ret;
int ret = -ENODEV;

struct ubi_volume *vol = container_of(dev, struct ubi_volume, dev);

spin_lock(&vol->ubi->volumes_lock);
if (vol->removed) {
spin_unlock(&vol->ubi->volumes_lock);
return -ENODEV;
return ret;
}
if (attr == &attr_vol_reserved_ebs)
ret = sprintf(buf, "%d\n", vol->reserved_pebs);
Expand Down

0 comments on commit 54b2c8f

Please sign in to comment.