asix-sigma: properly init driver-private storage
This commit is contained in:
parent
1644fb2473
commit
b32503cccd
|
@ -437,8 +437,13 @@ static void clear_instances(void)
|
|||
|
||||
static int hw_init(void)
|
||||
{
|
||||
struct drv_context *drvc;
|
||||
|
||||
/* Nothing to do. */
|
||||
if (!(drvc = g_try_malloc0(sizeof(struct drv_context)))) {
|
||||
sr_err("asix-sigma: driver context malloc failed.");
|
||||
return SR_ERR;
|
||||
}
|
||||
adi->priv = drvc;
|
||||
|
||||
return SR_OK;
|
||||
}
|
||||
|
@ -780,6 +785,9 @@ static int hw_dev_close(struct sr_dev_inst *sdi)
|
|||
static int hw_cleanup(void)
|
||||
{
|
||||
|
||||
if (!adi->priv)
|
||||
return SR_OK;
|
||||
|
||||
clear_instances();
|
||||
|
||||
return SR_OK;
|
||||
|
|
Loading…
Reference in New Issue