Re: [PATCH v3 04/10] scsi: ufs-mediatek: Fix the timing of configuring device regulators

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

 



On 6/14/22 07:16, Stanley Chu wrote:
+int ufs_mtk_system_suspend(struct device *dev)
+{
+	int ret = 0;
+	struct ufs_hba *hba = dev_get_drvdata(dev);
+
+	ret = ufshcd_system_suspend(dev);
+
+	if (!ret)
+		ufs_mtk_vreg_set_lpm(hba, true);
+
+	return ret;
+}


Please use the traditional kernel coding style and return early in case of an error. For the above code, that means to rewrite it as follows:

	struct ufs_hba *hba = dev_get_drvdata(dev);
	int ret;

	ret = ufshcd_system_suspend(dev);
	if (ret)
		return ret;

	ufs_mtk_vreg_set_lpm(hba, true);

	return 0;

+int ufs_mtk_system_resume(struct device *dev)
+{
+	int ret = 0;
+	struct ufs_hba *hba = dev_get_drvdata(dev);
+
+	ufs_mtk_vreg_set_lpm(hba, false);
+
+	ret = ufshcd_system_resume(dev);
+
+	return ret;
+}

Please remove the variable 'ret' from the above function.

+int ufs_mtk_runtime_suspend(struct device *dev)
+{
+	struct ufs_hba *hba = dev_get_drvdata(dev);
+	int ret = 0;
+
+	ret = ufshcd_runtime_suspend(dev);
+
+	if (!ret)
+		ufs_mtk_vreg_set_lpm(hba, true);
+
+	return ret;
+}

Please use the "early return" style.

+int ufs_mtk_runtime_resume(struct device *dev)
+{
+	struct ufs_hba *hba = dev_get_drvdata(dev);
+	int ret = 0;
+
+	ufs_mtk_vreg_set_lpm(hba, false);
+
+	ret = ufshcd_runtime_resume(dev);
+
+	return ret;
+}

Please remove the variable 'ret' from the above function.

Thanks,

Bart.



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [SCSI Target Devel]     [Linux SCSI Target Infrastructure]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Linux IIO]     [Samba]     [Device Mapper]

  Powered by Linux