lkml.org 
[lkml]   [2022]   [May]   [18]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH -next v2 6/6] nbd: use pr_err to output error message
From
Date
在 2022/05/19 2:12, Joe Perches 写道:
> On Wed, 2022-05-18 at 20:26 +0800, Yu Kuai wrote:
>> Instead of using the long printk(KERN_ERR "nbd: ...") to
>> output error message, defining pr_fmt and using
>> the short pr_err("") to do that. The replacemen is done
>> by using the following command:
>>
>> sed -i 's/printk(KERN_ERR "nbd: /pr_err("/g' \
>> drivers/block/nbd.c
>
> It's also good to rewrap to 80 columns where possible.
>
>> diff --git a/drivers/block/nbd.c b/drivers/block/nbd.c
> []
>> @@ -2130,13 +2130,13 @@ static int nbd_genl_disconnect(struct sk_buff *skb, struct genl_info *info)
>> nbd = idr_find(&nbd_index_idr, index);
>> if (!nbd) {
>> mutex_unlock(&nbd_index_mutex);
>> - printk(KERN_ERR "nbd: couldn't find device at index %d\n",
>> + pr_err("couldn't find device at index %d\n",
>> index);
>
> like here
>
>> return -EINVAL;
>> }
>> if (!refcount_inc_not_zero(&nbd->refs)) {
>> mutex_unlock(&nbd_index_mutex);
>> - printk(KERN_ERR "nbd: device at index %d is going down\n",
>> + pr_err("device at index %d is going down\n",
>> index);
>
> and here and below...
Hi, Josef

Thanks for your advice, I'll send a new version.
>
>> @@ -2170,7 +2170,7 @@ static int nbd_genl_reconfigure(struct sk_buff *skb, struct genl_info *info)
>> nbd = idr_find(&nbd_index_idr, index);
>> if (!nbd) {
>> mutex_unlock(&nbd_index_mutex);
>> - printk(KERN_ERR "nbd: couldn't find a device at index %d\n",
>> + pr_err("couldn't find a device at index %d\n",
>> index);
>> return -EINVAL;
>> }
>> @@ -2192,7 +2192,7 @@ static int nbd_genl_reconfigure(struct sk_buff *skb, struct genl_info *info)
>> }
>> if (!refcount_inc_not_zero(&nbd->refs)) {
>> mutex_unlock(&nbd_index_mutex);
>> - printk(KERN_ERR "nbd: device at index %d is going down\n",
>> + pr_err("device at index %d is going down\n",
>> index);
>> return -EINVAL;
>> }
>
>
>
> .
>

\
 
 \ /
  Last update: 2022-05-19 03:07    [W:0.047 / U:0.132 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site