| .. | .. |
|---|
| 17 | 17 | |
|---|
| 18 | 18 | if (d->props.i2c_algo == NULL) { |
|---|
| 19 | 19 | err("no i2c algorithm specified"); |
|---|
| 20 | | - return -EINVAL; |
|---|
| 20 | + ret = -EINVAL; |
|---|
| 21 | + goto err; |
|---|
| 21 | 22 | } |
|---|
| 22 | 23 | |
|---|
| 23 | | - strlcpy(d->i2c_adap.name, d->desc->name, sizeof(d->i2c_adap.name)); |
|---|
| 24 | + strscpy(d->i2c_adap.name, d->desc->name, sizeof(d->i2c_adap.name)); |
|---|
| 24 | 25 | d->i2c_adap.algo = d->props.i2c_algo; |
|---|
| 25 | 26 | d->i2c_adap.algo_data = NULL; |
|---|
| 26 | 27 | d->i2c_adap.dev.parent = &d->udev->dev; |
|---|
| 27 | 28 | |
|---|
| 28 | 29 | i2c_set_adapdata(&d->i2c_adap, d); |
|---|
| 29 | 30 | |
|---|
| 30 | | - if ((ret = i2c_add_adapter(&d->i2c_adap)) < 0) |
|---|
| 31 | + ret = i2c_add_adapter(&d->i2c_adap); |
|---|
| 32 | + if (ret < 0) { |
|---|
| 31 | 33 | err("could not add i2c adapter"); |
|---|
| 34 | + goto err; |
|---|
| 35 | + } |
|---|
| 32 | 36 | |
|---|
| 33 | 37 | d->state |= DVB_USB_STATE_I2C; |
|---|
| 34 | 38 | |
|---|
| 39 | +err: |
|---|
| 35 | 40 | return ret; |
|---|
| 36 | 41 | } |
|---|
| 37 | 42 | |
|---|