Skip to content

Commit 1c54ff4

Browse files
GuEe-GUIRbb666
authored andcommitted
[DM/FIXUP] Fixup block value init
Signed-off-by: GuEe-GUI <[email protected]>
1 parent 78f318a commit 1c54ff4

File tree

1 file changed

+6
-2
lines changed
  • components/drivers/block

1 file changed

+6
-2
lines changed

components/drivers/block/blk.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,10 @@ static rt_err_t blk_control(rt_device_t dev, int cmd, void *args)
195195
{
196196
err = disk->ops->control(disk, RT_NULL, cmd, args);
197197
}
198+
else
199+
{
200+
err = -RT_ENOSYS;
201+
}
198202
break;
199203
}
200204

@@ -344,7 +348,7 @@ rt_err_t rt_hw_blk_disk_unregister(struct rt_blk_disk *disk)
344348

345349
spin_lock(&disk->lock);
346350

347-
if (disk->parent.ref_count != 1)
351+
if (disk->parent.ref_count > 0)
348352
{
349353
err = -RT_EBUSY;
350354
goto _unlock;
@@ -470,7 +474,7 @@ INIT_ENV_EXPORT(blk_dfs_mnt_table);
470474
const char *convert_size(struct rt_device_blk_geometry *geome,
471475
rt_size_t sector_count, rt_size_t *out_cap, rt_size_t *out_minor)
472476
{
473-
rt_size_t cap, minor;
477+
rt_size_t cap, minor = 0;
474478
int size_index = 0;
475479
const char *size_name[] = { "B", "K", "M", "G", "T", "P", "E" };
476480

0 commit comments

Comments
 (0)