Re: [PATCH -next v2 6/6] nbd: use pr_err to output error message

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

 



在 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;
  	}



.




[Index of Archives]     [Linux RAID]     [Linux SCSI]     [Linux ATA RAID]     [IDE]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Device Mapper]

  Powered by Linux