I have faced this situation before also. I've run the hardware test and my both front and rear camera and flash LED failed in the test. I've tried restarting but nothing happened but after 2-3 days my camera gets back and working fine don't know how but after 3 weeks around this problem returned and now I have tried to clear data of camera app and gallery app, tried restarting my phone, tried wiping cache of phone in the recovery mode and even tried clearing user data from recovery mode of my smartphone but nothing works now. If it is a hardware failure camera at the first time wouldn't have come back.
Please help!!!
Please help!!!