Re: [Outreachy kernel] [PATCH v2 2/2] staging: iio: ad9834: Remove unnecessary goto label and compress return logic

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Mar 13, 2017 at 3:57 AM, Alison Schofield <amsfield22@xxxxxxxxx> wrote:
> On Mon, Mar 13, 2017 at 03:49:13AM +0530, sayli karnik wrote:
>> The patch removes excessive goto label and compresses return logic.
>>
>> Signed-off-by: sayli karnik <karniksayli1995@xxxxxxxxx>
>> ---
>>  drivers/staging/iio/frequency/ad9834.c | 6 ++----
>>  1 file changed, 2 insertions(+), 4 deletions(-)
>>
>> diff --git a/drivers/staging/iio/frequency/ad9834.c b/drivers/staging/iio/frequency/ad9834.c
>> index 60461a6..18f3e8f 100644
>> --- a/drivers/staging/iio/frequency/ad9834.c
>> +++ b/drivers/staging/iio/frequency/ad9834.c
>> @@ -147,9 +147,8 @@ static ssize_t ad9834_write(struct device *dev,
>>       int ret;
>>       unsigned long val;
>>
>> -     ret = kstrtoul(buf, 10, &val);
>> -     if (ret)
>> -             goto error_ret;
>> +     if (kstrtoul(buf, 10, &val))
>> +             return kstrtoul(buf, 10, &val);
>
> Will a smaller change suffice?
>
Yes, sending a solution without having to call the function twice.

> ret = kstrtoul(buf, 10, &val);
> if (ret)
> -       goto error_ret;
> +       return ret;
>
> alisons
>
>>
>>       mutex_lock(&st->lock);
>>       switch ((u32)this_attr->address) {
>> @@ -211,7 +210,6 @@ static ssize_t ad9834_write(struct device *dev,
>>       }
>>       mutex_unlock(&st->lock);
>>
>> -error_ret:
>>       return ret ? ret : len;
>>  }
>>
>> --
>> 2.7.4
>>
>> --
>> You received this message because you are subscribed to the Google Groups "outreachy-kernel" group.
>> To unsubscribe from this group and stop receiving emails from it, send an email to outreachy-kernel+unsubscribe@xxxxxxxxxxxxxxxx.
>> To post to this group, send email to outreachy-kernel@xxxxxxxxxxxxxxxx.
>> To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/59ddccc600cfd1594dcb4dadb44b80328fc06008.1489356140.git.karniksayli1995%40gmail.com.
>> For more options, visit https://groups.google.com/d/optout.
>
> --
> You received this message because you are subscribed to the Google Groups "outreachy-kernel" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to outreachy-kernel+unsubscribe@xxxxxxxxxxxxxxxx.
> To post to this group, send email to outreachy-kernel@xxxxxxxxxxxxxxxx.
> To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/20170312222738.GB14070%40d830.WORKGROUP.
> For more options, visit https://groups.google.com/d/optout.
--
To unsubscribe from this list: send the line "unsubscribe linux-iio" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Input]     [Linux Kernel]     [Linux SCSI]     [X.org]

  Powered by Linux