Re: [PATCH V2] Fix return value from fstat calls

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

 



Hi Nigel,
On 11.08.2021 21:09, Nigel Croxon wrote:

+				pr_err("fstat failed for %s: %s\n",devname, strerror(errno));
+		pr_err("fstat failed from %s: %s\n",fname, strerror(errno));
Typo, I guess that you want to use "for".

+			pr_err("fstat failed for %s: %s\n",dev, strerror(errno));
+		pr_err("fstat failed for %s: %s\n",devname, strerror(errno));
+		pr_err("fstat failed for %s: %s\n",devname, strerror(errno));
+		pr_err("fstat failed: %s\n", strerror(errno));
+			pr_err("fstat failed: %s\n", strerror(errno));
+		pr_err("fstat failed for %s: %s\n",devname, strerror(errno));
+		pr_err("fstat failed for %s: %s\n",devname, strerror(errno));

+		pr_err("fstat failed for %s: %s\n",devname, strerror(errno));
+		pr_err("fstat failed for %s: %s\n",devname, strerror(errno));

You are using similar error message across code. If you think that printing
error in this case is worth to be added then please define wrapper for fstat
with error message and use that.
Current solution is typo friendly (and I found one) and breaks DNRY rule.
Any modern C IDE is able to find references- result is same as in search via
string in case of error.

Mariusz



[Index of Archives]     [Linux RAID Wiki]     [ATA RAID]     [Linux SCSI Target Infrastructure]     [Linux Block]     [Linux IDE]     [Linux SCSI]     [Linux Hams]     [Device Mapper]     [Device Mapper Cryptographics]     [Kernel]     [Linux Admin]     [Linux Net]     [GFS]     [RPM]     [git]     [Yosemite Forum]


  Powered by Linux