asix-sigma: properly init driver-private storage

This commit is contained in:
Bert Vermeulen 2012-08-02 21:42:37 +02:00
parent 1644fb2473
commit b32503cccd
1 changed files with 9 additions and 1 deletions

View File

@ -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;